You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
As explained in #4049 (comment) we did all unsetting/setting logic during diff which meant that if we changed the level of an element we would set --> unset if the level moved lower down.
To counter-act this we execute unsetting first and setting later, which is also inline with how react does it in React you see a series of unsets and only after you see a series of sets.
Because we queue useLayoutEffect to the commit phase we still ensures that refs are set correctly.
The reason will be displayed to describe this comment to others. Learn more.
Oh nice! This fixes an issue I've been chasing for a lil while (#3860), but I like this better. It's quite bit a simpler and less impactful to stuff. Nice!
Would you mind if I pushed some tests from #3860 this PR fixes? I can also do a follow up PR if you prefer :)
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.
fixes #4049
As explained in #4049 (comment) we did all unsetting/setting logic during diff which meant that if we changed the level of an element we would set --> unset if the level moved lower down.
To counter-act this we execute unsetting first and setting later, which is also inline with how react does it in React you see a series of unsets and only after you see a series of sets.
Because we queue
useLayoutEffect
to the commit phase we still ensures that refs are set correctly.