Update to how we handle null or undefined Suspense fallbacks #72
rickhanlonii
announced in
Announcement
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
We've made a change to the way nullish Suspense fallbacks are handled in the latest alpha. tl;dr: We don't skip Suspense boundaries with missing or null fallbacks any more. Instead, we capture the boundary and render null for the fallback.
Background
Previously, if you had a Suspense boundary that didn't provide a fallback, we would silently skip it and continue searching upwards for the next boundary:
We found that this can result in confusing, hard to debug situations. For example, if you're debugging an issue and throw in a quick boundary without a fallback to test an issue, it won't change the behavior of the app as you may expect and there's no warning that it's missing a fallback.
Change
Now, we will use the Suspense boundary, even if the fallback is null or undefined:
This change means that we're no longer silently skipping boundaries. Instead, we'll capture at the boundary and render the fallback as if you provided a component that returned null. This means the semantics of suspending will work as expected, and if you forget to provide a fallback then you'll see the null loading state.
Beta Was this translation helpful? Give feedback.
All reactions