Skip to content
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: startTransition gets stuck on infinite Suspense #29126

Closed
Linksku opened this issue May 17, 2024 · 2 comments
Closed

Bug: startTransition gets stuck on infinite Suspense #29126

Linksku opened this issue May 17, 2024 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@Linksku
Copy link

Linksku commented May 17, 2024

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

  1. Have a component that suspends indefinitely (e.g. frozen using React Freeze)
  2. setState inside startTransition

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:

  1. make startTransition not wait for the suspended component OR
  2. enable time slicing without startTransition
@Linksku Linksku added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 17, 2024
@AlishRani
Copy link

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.

@rickhanlonii
Copy link
Member

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.

@rickhanlonii rickhanlonii closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants