-
Notifications
You must be signed in to change notification settings - Fork 49.4k
Closed
Description
React version: 0.0.0-experimental-aae83a4b9
Steps To Reproduce
- Wrap and error boundary around a suspense boundary inside a
<SuspenseList revealOrder="together" />
- Crash with
Cannot read property 'shared' of null
Link to code example:
https://codesandbox.io/s/quirky-cannon-e4t1c is forked from https://codesandbox.io/s/black-wind-byilt
The current behavior
The following code causes the described crash:
<SuspenseList revealOrder="together">
<ErrorBoundary fallback={null}>
<Suspense fallback={<h2>Loading posts...</h2>}>
<ProfileTimeline resource={resource} />
</Suspense>
</ErrorBoundary>
<Suspense fallback={<h2>Loading fun facts...</h2>}>
<ProfileTrivia resource={resource} />
</Suspense>
</SuspenseList>
revealOrder="forwards"
does not crash as well as placing the error boundary inside the suspense boundary like so:
<SuspenseList revealOrder="together">
<Suspense fallback={<h2>Loading posts...</h2>}>
<ErrorBoundary fallback={null}>
<ProfileTimeline resource={resource} />
</ErrorBoundary>
</Suspense>
<Suspense fallback={<h2>Loading fun facts...</h2>}>
<ProfileTrivia resource={resource} />
</Suspense>
</SuspenseList>
The expected behavior
The position of the ErrorBoundary is likely wrong in the first place (since I can move it around to not cause a crash while preserving the semantics I expect). Maybe this needs a descriptive warning/error why this is happening and how I should resolve it?