Bug: startTransition gets stuck on infinite Suspense
I'm building a mobile web app with tabs and stack navigation, so I need Offscreen or React Freeze (https://github.com/software-mansion/react-freeze, simulates Offscreen using Suspense). If I also use startTransition, the updates within startTransition never get rendered.
React version: 18.3.1
Steps To Reproduce
- Have a component that suspends indefinitely (e.g. frozen using React Freeze)
-
setStateinsidestartTransition
Link to code example: https://codesandbox.io/p/sandbox/blazing-wood-nmw92p
The current behavior
React waits for the frozen component to unsuspend before completing the transition.
The expected behavior
React ignores the frozen component and completes the transition as if the frozen component wasn't there.
Additional info
I don't want transitions to wait for suspended components, I'm just using startTransition for time slicing. I know it was intentional to make transitions wait for suspended components to avoid showing too many spinners, but not everyone wants that, I think there should be a way to enable time slicing without opting in to this feature. I think before, I could've done something like useTransition({ timeoutMs: 0 }), which should've allowed me to complete the transition while ignoring suspense.
With React 18, is there a way to either:
- make
startTransitionnot wait for the suspended component OR - enable time slicing without
startTransition
Hi [Linksku],
I'm excited about contributing to mobile App project using React . I'd love to help with the issue and would appreciate any guidance you can provide on getting started.I have a humble request to assign me this project.
Thank.
This is expected, when you infinitely suspend, we can't commit the update. This isn't an issue outside of transitions because we can commit the fallback, but transitions will not commit or display a fallback until the suspense resolves.