File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3366,8 +3366,16 @@ function pingSuspendedRoot(
3366
3366
includesOnlyRetries ( workInProgressRootRenderLanes ) &&
3367
3367
now ( ) - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS )
3368
3368
) {
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
+ }
3371
3379
} else {
3372
3380
// Even though we can't restart right now, we might get an
3373
3381
// opportunity later. So we mark this render as having a ping.
You can’t perform that action at this time.
0 commit comments