diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index 75da91a5da89d..bd745e02d12a2 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -4037,6 +4037,9 @@ function beginWork( ); } case IncompleteFunctionComponent: { + if (disableLegacyMode) { + break; + } const Component = workInProgress.type; const unresolvedProps = workInProgress.pendingProps; const resolvedProps = diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.js b/packages/react-reconciler/src/ReactFiberCompleteWork.js index 04a1c013b075d..51e21b8d2f480 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.js @@ -950,10 +950,15 @@ function completeWork( // for hydration. popTreeContext(workInProgress); switch (workInProgress.tag) { + case IncompleteFunctionComponent: { + if (disableLegacyMode) { + break; + } + // Fallthrough + } case LazyComponent: case SimpleMemoComponent: case FunctionComponent: - case IncompleteFunctionComponent: case ForwardRef: case Fragment: case Mode: diff --git a/packages/react-reconciler/src/getComponentNameFromFiber.js b/packages/react-reconciler/src/getComponentNameFromFiber.js index d3d2d7dd638a3..6659b14b7f0d0 100644 --- a/packages/react-reconciler/src/getComponentNameFromFiber.js +++ b/packages/react-reconciler/src/getComponentNameFromFiber.js @@ -36,6 +36,7 @@ import { SimpleMemoComponent, LazyComponent, IncompleteClassComponent, + IncompleteFunctionComponent, DehydratedFragment, SuspenseListComponent, ScopeComponent,