dillon1000/react

Commit

Fix: Stylesheet in error UI suspends indefinitely (#27265)

This fixes the regression test added in the previous commit. The
"Suspensey commit" implementation relies on the
`shouldRemainOnPreviousScreen` function to determine whether to 1)
suspend the commit 2) activate a parent fallback and schedule a retry.
The issue was that we were sometimes attempting option 2 even when there
was no parent fallback.

Part of the reason this bug landed is due to how `throwException` is
structured. In the case of Suspensey commits, we pass a special "noop"
thenable to `throwException` as a way to trigger the Suspense path. This
special thenable must never have a listener attached to it. This is not
a great way to structure the logic, it's just a consequence of how the
code evolved over time. We should refactor it into multiple functions so
we can trigger a fallback directly without having to check the type. In
the meantime, I added an internal warning to help detect similar
mistakes in the future.
Browse files
Changed paths4 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMFloat-test.js ModifiedM packages/react-reconciler/src/ReactFiberThenable.js ModifiedM packages/react-reconciler/src/ReactFiberThrow.js ModifiedM packages/react-reconciler/src/ReactFiberWorkLoop.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…