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(
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.
You can’t perform that action at this time.
0 commit comments