diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index cc5a8b00563b2..32144cc1b0505 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -471,6 +471,21 @@ export function renderWithHooks( currentHookNameInDev = null; hookTypesDev = null; hookTypesUpdateIndexDev = -1; + + // Confirm that a static flag was not added or removed since the last + // render. If this fires, it suggests that we incorrectly reset the static + // flags in some other part of the codebase. This has happened before, for + // example, in the SuspenseList implementation. + if ( + current !== null && + (current.flags & PassiveStaticEffect) !== + (workInProgress.flags & PassiveStaticEffect) + ) { + console.error( + 'Internal React error: Expected static flag was missing. Please ' + + 'notify the React team.', + ); + } } didScheduleRenderPhaseUpdate = false; diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index b5eefde63f715..ce0ac36636562 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -471,6 +471,21 @@ export function renderWithHooks( currentHookNameInDev = null; hookTypesDev = null; hookTypesUpdateIndexDev = -1; + + // Confirm that a static flag was not added or removed since the last + // render. If this fires, it suggests that we incorrectly reset the static + // flags in some other part of the codebase. This has happened before, for + // example, in the SuspenseList implementation. + if ( + current !== null && + (current.flags & PassiveStaticEffect) !== + (workInProgress.flags & PassiveStaticEffect) + ) { + console.error( + 'Internal React error: Expected static flag was missing. Please ' + + 'notify the React team.', + ); + } } didScheduleRenderPhaseUpdate = false;