-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
flushSync implementation needed for new View Transitions API #3929
Comments
BTW, the comment of the no-op "implementation" in Preact says that
The latter one doesn't seem to be true, at least it is not documented in the latest reference that The React documentation however says:
This makes a lot of sense in certain scenarios, like in the case described above (View Transitions API). |
As commented in #3928, the flush of the queue actually doesn't have to be synchronous. The callback passed to But I think that there's a chance that 3rd party libraries will use React's |
@sschultze yeah, just tried to implement view transitions, and the problem is that, returning from the callback is only half the battle -- you seemingly need to block rendering until that callback is called. for example, if you try and start a view transition in, for example, componentWillUpdate, and end it in componentDidUpdate, as componentWillUpdate will fire before the view transition before snapshot has been created and the callback has been called. |
@foxt You should do anything that will cause a render, like |
Describe the feature you'd love to see
The documentation of the View Transitions API available in Chrome 111+ has a section Working with frameworks which mentions React's
flushSync
function as a key to use it together with the View Transitions API.Because when using
startViewTransition
, you have to ensure that the DOM is completely updated, which is whatflushSync
does.Preact's implementation of
flushSync
however is currently just a no-op.So my suggestion is to implement
flushSync
so that it ensures that the DOM is updated completely like described here.The text was updated successfully, but these errors were encountered: