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

Bugfix: SuspenseList incorrectly forces a fallback #26453

Merged
merged 1 commit into from
Mar 22, 2023

Commits on Mar 22, 2023

  1. Bugfix: SuspenseList incorrectly forces a fallback

    Fixes a bug in SuspenseList that @kassens found when deploying React to
    Meta. In some scenarios, SuspenseList would force the fallback of a
    deeply nested Suspense boundary into fallback mode, which should
    never happen under any circumstances — SuspenseList should only affect
    the nearest descendent Suspense boundaries, without going deeper.
    
    The cause was that the internal ForceSuspenseFallback context flag was
    not being properly reset when it reached the nearest Suspense boundary.
    It should only be propagated shallowly.
    
    We didn't discover this earlier because the scenario where it happens is
    not that common. To trigger the bug, you need to insert a new Suspense
    boundary into an already-mounted row of the list. But often when a new
    Suspense boundary is rendered, it suspends and shows a fallback, anyway,
    because its content hasn't loaded yet.
    
    Another reason we didn't discover this earlier is because there was
    another bug that was accidentally masking it, which was fixed by facebook#25922.
    When that fix landed, it revealed this bug.
    
    The SuspenseList implementation is complicated but I'm not too concerned
    with the current messiness. It's an experimental API, and we intend to
    release it soon, but there are some known flaws and missing features
    that we need to address first regardless. We'll likely end up rewriting
    most of it.
    
    Co-Authored-By: Jan Kassens <[email protected]>
    acdlite and kassens committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    f7d3219 View commit details
    Browse the repository at this point in the history