react/packages/react-reconciler/src
Andrew Clark 51a7c45f87
Bugfix: SuspenseList incorrectly forces a fallback (#26453)
Fixes a bug in SuspenseList that @kassens found when deploying React to
Meta. In some scenarios, SuspenseList would force the fallback of a
deeply nested Suspense boundary into fallback mode, which should never
happen under any circumstances — SuspenseList should only affect the
nearest descendent Suspense boundaries, without going deeper.

The cause was that the internal ForceSuspenseFallback context flag was
not being properly reset when it reached the nearest Suspense boundary.
It should only be propagated shallowly.

We didn't discover this earlier because the scenario where it happens is
not that common. To trigger the bug, you need to insert a new Suspense
boundary into an already-mounted row of the list. But often when a new
Suspense boundary is rendered, it suspends and shows a fallback, anyway,
because its content hasn't loaded yet.

Another reason we didn't discover this earlier is because there was
another bug that was accidentally masking it, which was fixed by #25922.
When that fix landed, it revealed this bug.

The SuspenseList implementation is complicated but I'm not too concerned
with the current messiness. It's an experimental API, and we intend to
release it soon, but there are some known flaws and missing features
that we need to address first regardless. We'll likely end up rewriting
most of it.

Co-authored-by: Jan Kassens <jkassens@meta.com>
2023-03-22 13:33:02 -04:00
..
__mocks__/scheduler [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
__tests__ Bugfix: SuspenseList incorrectly forces a fallback (#26453) 2023-03-22 13:33:02 -04:00
forks Check if suspensey instance resolves in immediate task (#26427) 2023-03-20 12:35:10 -04:00
DebugTracing.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
MaxInts.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactCapturedValue.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactChildFiber.js Support Context as renderable node (#25641) 2023-03-11 17:34:31 -05:00
ReactCurrentFiber.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactEventPriorities.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiber.js Avoid meta programming to initialize functions in module scope (#26388) 2023-03-14 21:00:22 -04:00
ReactFiberAct.js Upgrade to Flow 0.196.3 (#25974) 2023-01-09 17:52:42 -05:00
ReactFiberBeginWork.js Bugfix: SuspenseList incorrectly forces a fallback (#26453) 2023-03-22 13:33:02 -04:00
ReactFiberCache.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberCacheComponent.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
ReactFiberClassComponent.js Avoid meta programming to initialize functions in module scope (#26388) 2023-03-14 21:00:22 -04:00
ReactFiberClassUpdateQueue.js Upgrade Flow to 0.201 (#26326) 2023-03-06 10:33:22 -05:00
ReactFiberCommitWork.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberCompleteWork.js Bugfix: Remove extra render pass when reverting to client render (#26445) 2023-03-20 22:07:53 -04:00
ReactFiberComponentStack.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
ReactFiberConcurrentUpdates.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberDevToolsHook.js SchedulerMock.unstable_yieldValue -> SchedulerMock.log (#26312) 2023-03-06 11:09:07 -05:00
ReactFiberErrorDialog.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberErrorLogger.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberFlags.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberHiddenContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberHooks.js Setting transition pending flag shouldn't be part of a surrounding transition (#26243) 2023-03-15 18:10:53 -07:00
ReactFiberHostConfig.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoHydration.js [Float][Fizz][Fiber] - Do not hoist elements with `itemProp` & hydrate more tolerantly in hoist contexts (#26256) 2023-03-06 15:00:54 -08:00
ReactFiberHostConfigWithNoMicrotasks.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoMutation.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoPersistence.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoResources.js [Float][Fiber] implement a faster hydration match for hoistable elements (#26154) 2023-03-06 19:52:35 -08:00
ReactFiberHostConfigWithNoScopes.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoSingletons.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberHostConfigWithNoTestSelectors.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostContext.js [Float][Fizz][Fiber] - Do not hoist elements with `itemProp` & hydrate more tolerantly in hoist contexts (#26256) 2023-03-06 15:00:54 -08:00
ReactFiberHotReloading.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
ReactFiberHydrationContext.js Fix enableClientRenderFallbackOnTextMismatch flag (#26457) 2023-03-22 13:12:41 -04:00
ReactFiberLane.js Refactor: remove useless parameter (#25923) 2023-01-09 23:25:02 -05:00
ReactFiberLazyComponent.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberNewContext.js Support Context as renderable node (#25641) 2023-03-11 17:34:31 -05:00
ReactFiberOffscreenComponent.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberReconciler.js Remove unstable_flushControlled (#26397) 2023-03-15 16:13:54 -04:00
ReactFiberRoot.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberScope.js [flow] enable exact_empty_objects (#25973) 2023-01-09 17:00:36 -05:00
ReactFiberShellHydration.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberStack.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberSuspenseComponent.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberSuspenseContext.js Bugfix: SuspenseList incorrectly forces a fallback (#26453) 2023-03-22 13:33:02 -04:00
ReactFiberSyncTaskQueue.js flushSync: Exhaust queue even if something throws (#26366) 2023-03-10 17:21:34 -05:00
ReactFiberThenable.js Check if suspensey instance resolves in immediate task (#26427) 2023-03-20 12:35:10 -04:00
ReactFiberThrow.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactFiberTracingMarkerComponent.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberTransition.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberTreeContext.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberTreeReflection.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
ReactFiberUnwindWork.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
ReactFiberWorkLoop.js Don't prerender siblings of suspended component (#26380) 2023-03-21 10:24:56 -04:00
ReactHookEffectTags.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactInternalTypes.js Feature: Suspend commit without blocking render (#26398) 2023-03-17 18:05:11 -04:00
ReactMutableSource.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactPortal.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactPostPaintCallback.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactProfilerTimer.js [flow] enable LTI inference mode (#26104) 2023-02-09 17:07:39 -05:00
ReactReconcilerConstants.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactRootTags.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactStrictModeWarnings.js [flow] enable LTI inference mode (#26104) 2023-02-09 17:07:39 -05:00
ReactTestSelectors.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
ReactTypeOfMode.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactWorkTags.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00
Scheduler.js SchedulerMock.unstable_yieldValue -> SchedulerMock.log (#26312) 2023-03-06 11:09:07 -05:00
clz32.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
getComponentNameFromFiber.js Model Float on Hoistables semantics (#26106) 2023-02-09 22:59:29 -08:00