Skip to content

Commit

Permalink
Fix regression test added in previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Dec 8, 2022
1 parent eb55f90 commit 9659788
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -3366,8 +3366,16 @@ function pingSuspendedRoot(
includesOnlyRetries(workInProgressRootRenderLanes) &&
now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS)
) {
// Restart from the root.
prepareFreshStack(root, NoLanes);
// Force a restart from the root by unwinding the stack. Unless this is
// being called from the render phase, because that would cause a crash.
if ((executionContext & RenderContext) === NoContext) {
prepareFreshStack(root, NoLanes);
} else {
// TODO: If this does happen during the render phase, we should throw
// the special internal exception that we use to interrupt the stack for
// selective hydration. That was temporarily reverted but we once we add
// it back we can use it here.
}
} else {
// Even though we can't restart right now, we might get an
// opportunity later. So we mark this render as having a ping.
Expand Down

0 comments on commit 9659788

Please sign in to comment.