From 25deae9dffd3ef3f7cfe2cea8d64150118102623 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Tue, 10 Sep 2019 19:32:12 -0700 Subject: [PATCH] Handle SuspenseListComponent getting retried This happens for example when a deleted boundary transfers its pending promises to the list so that the list can be retried. This wasn't caught by unit tests because this flag wasn't on in those tests. --- packages/react-reconciler/src/ReactFiberWorkLoop.js | 4 ++++ .../src/__tests__/ReactSuspenseList-test.internal.js | 1 + 2 files changed, 5 insertions(+) diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index e02ae2d5f8f92..cfa2f3e0e959e 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -77,6 +77,7 @@ import { HostRoot, ClassComponent, SuspenseComponent, + SuspenseListComponent, FunctionComponent, ForwardRef, MemoComponent, @@ -2223,6 +2224,9 @@ export function resolveRetryThenable(boundaryFiber: Fiber, thenable: Thenable) { retryTime = suspenseState.retryTime; } break; + case SuspenseListComponent: + retryCache = boundaryFiber.stateNode; + break; default: invariant( false, diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js index f9b46822cd4c7..428f7ff95f2f2 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js @@ -11,6 +11,7 @@ describe('ReactSuspenseList', () => { ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false; + ReactFeatureFlags.enableSuspenseServerRenderer = true; React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler');