Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
add uiFind icons, scroll to first match #367
add uiFind icons, scroll to first match #367
Changes from 1 commit
a0e296a
ebf9473
37f9a20
bb66f09
79f04af
79eb6df
8a268c2
5a146ef
43a8ca5
5801d3e
73e8691
7651dbc
9b9f5c0
cdbdd9d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the
setTimeout
it scrolls to the bottom. I think the rows may not have height in the initial render.@tiffon do you have any insight on why this would scroll too far without the
setTimeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the constructor calls
setTrace(...)
. When visiting the URL, directly, thesetTrace(...)
applies the find matching.When coming from the search page the
setTimeout
has no effect; the find is already applied to the redux state via the reducer that changed the state to be viewing the trace.So, seems like the rows are rendered but they're not collapsed, yet, when visiting a trace directly from a URL. Probably it's scrolling to the position of the row, but then the non-matching rows are collapsed and the target scroll position ends up getting truncated with the result of being scrolled to the bottom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scroll destination changes as a result of dispatching
focusUiFind
. ThissetTimeout
achieves the desired result but definitely seems like the wrong way to achieve this.@tiffon how would you recommend scrolling to the first match only after the rows have been expanded/collapsed and had their children shown/hidden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tough one, maybe via
componentDidUpdate()
with an instance property indicating whether or not the component should scroll.Also, I recommend turning this into a method instead of creating a new function with every render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately an instance property wouldn't work because the component that updates as a result of
focusUiFind
is notTracePage/index.tsx
. I got around this by adding a property to thedetailStates
Map andchildrenHiddenIDs
Set made bycalculateHiddenIdsAndDetailStates
inTracePage/duck.tsx
and reading that property incomponentDidUpdate
inTraceTimelineViewer/VirtualizedTraceView.tsx
It's slightly unorthodox in principle, but not so bad in practice.
Here is the commit that solely addresses setTimeout
TODO: more tests and icons