React version: 0.0.0-experimental-aae83a4b9
<SuspenseList revealOrder="together" />Cannot read property 'shared' of nullLink to code example:
https://codesandbox.io/s/quirky-cannon-e4t1c is forked from https://codesandbox.io/s/black-wind-byilt
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 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?
Sounds like a bug.
Would you mind sending this as a PR with a failing test? You can see existing SuspenseList tests as an inspiration.
Added test in https://github.com/facebook/react/pull/18432
This is reproducible with a basic class component which means the assumption in
https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactUpdateQueue.js#L399-L401
does not hold. This guard was removed in https://github.com/facebook/react/commit/7bf40e1cfdb780788700a41bf30163fdb8d105a3#diff-b69c8f2165f95ef2355ac661c12fa407L867
Closed in #18448
Most helpful comment
Would you mind sending this as a PR with a failing test? You can see existing SuspenseList tests as an inspiration.