-
Notifications
You must be signed in to change notification settings - Fork 48.4k
It's confusing that useTransition doesn't do anything outside of user-blocking events #17279
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Ah, I see... As useTransition doesn't do anything in useEffect, I assumed it's by design. window.addEventListener('popstate', wrapCallbackWithUserBlockingPriority(handlePopState));
// or even something like ReactDOM.addEventListener('popstate', handlePopState) I mean the question is only about useTransition, or any other issues suffer from low priority callbacks even if they are user initiated. |
You generally shouldn't run something with user-blocking priority unless it was actually initiated by user. Back Button is. |
Is it only |
I have been playing around with concurrent mode and I'm impressed with how well the pieces fit together and easy it is to design complex transitions. Well done! Regarding transitions, does it make sense to do a timeout on the initial render? and in case it does, how would I go about doing that? |
Closing as a duplicate of #17272 |
I ran into this when implementing Back button transition in a router. Because the transition is inside a browser
popstate
event, it gets batched with the low pri update, and the pending state doesn't appear.I had to do this to work around it but it's unfortunate. We might want to fix this by treating pending state as special. Or maybe a warning — but then we need a first-class official API for opting into user blocking pri.
The text was updated successfully, but these errors were encountered: