Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep event sheet scroll location when switching functions #7279

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

D8H
Copy link
Collaborator

@D8H D8H commented Jan 5, 2025

No description provided.

@D8H D8H requested a review from 4ian as a code owner January 5, 2025 23:00
Comment on lines 498 to 504
scrollToPosition(position: number) {
const currentList = this._list;
if (currentList) {
const listWrapper = currentList.wrappedInstance.current;
listWrapper && listWrapper.scrollToPosition(position);
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not actually used. Should I remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it used by the EventsSheet when you call scrollToPosition?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, which is not used either.

Copy link
Owner

@4ian 4ian Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes let's clean dead functions. Because these things are hard to get right, we might as well avoid making the component public surface more complex than what it should be

Copy link
Owner

@4ian 4ian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok without dead functions

@@ -333,6 +333,7 @@ type EventsTreeProps = {|
onEventMoved: (previousRowIndex: number, nextRowIndex: number) => void,
onEndEditingEvent: (event: gdBaseEvent) => void,
onScroll?: () => void,
scrollPosition?: number,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this initialScrollPosition because changing this props won't impact a component already mounted

@D8H D8H force-pushed the function-scroll branch from a8c27c9 to c4f1f4c Compare January 6, 2025 16:53
@D8H
Copy link
Collaborator Author

D8H commented Jan 6, 2025

The List seems to fight the scroll change to set it back to 0. It causes the component to render 11 times instead of 4.
I guess the issue is that the List height is still 0 at the beginning. I'll try to see if there is a way to detect when events heights are ready to avoid to do the scroll change too soon.

@D8H D8H force-pushed the function-scroll branch from c4f1f4c to 1e8debf Compare January 6, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants