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
Bug: useTransition and uSES do not work together, uT is not resilient to amount-of-render #26814
Comments
I'm not sure if it's described well in react-18 WG discussions (I think there was a tweet about it from Seb.), but the "Sync" is important. It's not |
I hit the same behavior and it was far from obvious in my case, because uSES wasn't the one that supposed to be triggering suspense. I created this sandbox https://codesandbox.io/s/upbeat-flower-2gnhm6 to show that the shim implementation ( Screen.Recording.2023-06-19.at.11.37.48.mov |
I'll tag in a related React-Redux issue: |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Bump. There was no patch for it and we are yet to discover if v19 fixes the issue. |
I can confirm that this bug is still present in React Screen.Recording.2024-04-26.at.08.16.37.mov |
React version: 18.2.0
Steps To Reproduce
We learn that components should not rely on render. But useTransition does seem to rely on it. If we wrap a set into a useTransition:
everything that now suspends because of it is marked as a transition, it will not go into suspense fallback but instead
pending
will be true. ✅But if the suspending component, for whatever reason, happens to render again while still in suspense, giving react the same promise that it already has, then it will unpend because that render wasn't marked a transition. ❌
This at least happens when state managers are built on uSES.
Link to code example:
https://codesandbox.io/s/cool-fast-pcz6bv?file=/src/App.js
The current behavior
In that sandbox it:
The expected behavior
startTransition should mark the component that suspended a transition as long as it suspends.
btw, @dai-shi has an extension that lets us use zustand without uSES, it does not happen then: https://codesandbox.io/s/suspicious-hooks-hdvxhl?file=/src/App.js
The text was updated successfully, but these errors were encountered: