-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: SC-59775 fix nested select height after long render #1084
Merged
0ces
merged 4 commits into
main
from
SC-59775/fix-nested-select-height-after-long-render
Oct 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
@0ces just curious, but is this only an issue in virtualized tables, or just any GridTable?
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.
@stephenh I think only in virtualized tables, it happens when the columns change (remove/hide a column) and the tables changes from not grouped to grouped, I'll have a PR that solves the bug in our front-end by not changing the column when the table gets grouped.
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.
@0ces so I'm not following if (when a column is hidden/changed from grouped to not grouped):
a) this
useLayoutEffect
is actually triggered by a dirty deps change (so we almost work), but because of "reasons related to virtualization", the measurement isn't correct, and we need to try again, orb) this
useLayoutEffect
just isn't triggered at all when column is hidden/grouped, but the200ms
from the original/only invocation happens to catch it.I'm thinking surely it's not b), because 200ms is so small...
Can you confirm a) vs. b)?
Fwiw my musing is that, because of virtualization, react-virtuoso (or GridTable) is being "smart" and not even causing our cell to get re-rendered?...
@blambillotte do you understand how/why this fix works?
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.
Interesting 🤔 I wonder if the check on line 40 is allowing the similar code (with the same
setTimeout
hack) on line 41 to run or not - I sort of assume the added time has no real impact vs just moving out of the sync call stack due to the setTimeout.I can pull this down and poke a bit
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.
@stephenh this bug it's "hard" to reproduce, I think option b is the closest to what I've seen, but when it happens it is consistent, when trying to debug these it looked like 200ms was just enough for the
onHeightChange
to read the real final height and scroll states of the refs. I'll try to add a test that reproduces this.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.
Nice! Really appreciate the storybook!
Maybe update this in-source comment to just include "See the InVirtualizedTable storybook for reproducing this behavior", so maintainers know exactly where to go to futz with this line/setTimeout.