-
Notifications
You must be signed in to change notification settings - Fork 4
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: batch flushSync execution within a microtask #273
Merged
Conversation
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
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 15, 2024 14:28
9ba8bc6
to
0ca7e1c
Compare
1 task
vursen
changed the title
refactor: revert Grid to async rendering
fix: revert Grid to async rendering
Nov 15, 2024
tomivirkki
reviewed
Nov 18, 2024
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 18, 2024 12:57
1090856
to
33625f3
Compare
tomivirkki
reviewed
Nov 18, 2024
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
2 times, most recently
from
November 19, 2024 15:00
e228dc6
to
768626e
Compare
vursen
changed the title
fix: revert Grid to async rendering
fix: batch flushSync execution within a microtask
Nov 20, 2024
tomivirkki
reviewed
Nov 20, 2024
Co-authored-by: Tomi Virkki <[email protected]>
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 20, 2024 13:30
4818b22
to
5a8d15b
Compare
tomivirkki
reviewed
Nov 20, 2024
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 21, 2024 06:36
d1e4617
to
d01f67c
Compare
tomivirkki
approved these changes
Nov 21, 2024
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 21, 2024 10:39
84ed982
to
d502a0b
Compare
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 21, 2024 10:40
d502a0b
to
9199d2f
Compare
vursen
force-pushed
the
refactor/revert-grid-to-async-rendering
branch
from
November 21, 2024 11:37
98fe6e7
to
870c524
Compare
vaadin-bot
pushed a commit
that referenced
this pull request
Nov 21, 2024
vaadin-bot
pushed a commit
that referenced
this pull request
Nov 21, 2024
vursen
added a commit
that referenced
this pull request
Nov 21, 2024
Co-authored-by: Sergey Vinogradov <[email protected]>
vursen
added a commit
that referenced
this pull request
Nov 21, 2024
Co-authored-by: Sergey Vinogradov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Simply wrapping renderers in
flushSync
doesn't guarantee that the DOM will be updated synchronously. React may still defer it to a micro task ifflushSync
was called while rendering was already in progress, which is explained in the previously suppressed warning:When there are many deferred sync renderers that in turn trigger some async renderers, it can create race conditions that React misinterprets as a possible infinite loop:
This warning particularly often occurs in AutoGrid where a mix of sync (GridColumn) and async (Select) renderers is used.
This PR updates Grid renderers to batch
flushSync
execution within a microtask, which resolves the maximum depth warning and is also good for performance. That being said, GridPro's editModeRenderer continues to use unbatchedflushSync
because its web component currently requires the editor to render synchronously.Fixes #255
Type of change