Skip to content

Commit c5dab6c

Browse files
committed
Fix regression test added in previous commit
1 parent 0be3c0b commit c5dab6c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3366,8 +3366,16 @@ function pingSuspendedRoot(
33663366
includesOnlyRetries(workInProgressRootRenderLanes) &&
33673367
now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS)
33683368
) {
3369-
// Restart from the root.
3370-
prepareFreshStack(root, NoLanes);
3369+
// Force a restart from the root by unwinding the stack. Unless this is
3370+
// being called from the render phase, because that would cause a crash.
3371+
if ((executionContext & RenderContext) === NoContext) {
3372+
prepareFreshStack(root, NoLanes);
3373+
} else {
3374+
// TODO: If this does happen during the render phase, we should throw
3375+
// the special internal exception that we use to interrupt the stack for
3376+
// selective hydration. That was temporarily reverted but we once we add
3377+
// it back we can use it here.
3378+
}
33713379
} else {
33723380
// Even though we can't restart right now, we might get an
33733381
// opportunity later. So we mark this render as having a ping.

0 commit comments

Comments
 (0)