diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index a7bb6e6df5a..a2ecf0d5b4b 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -430,33 +430,21 @@ function updateForwardRef( } // The rest is a fork of updateFunctionComponent - let nextChildren; - let hasId; prepareToReadContext(workInProgress, renderLanes); if (enableSchedulingProfiler) { markComponentRenderStarted(workInProgress); } - if (__DEV__) { - nextChildren = renderWithHooks( - current, - workInProgress, - render, - propsWithoutRef, - ref, - renderLanes, - ); - hasId = checkDidRenderIdHook(); - } else { - nextChildren = renderWithHooks( - current, - workInProgress, - render, - propsWithoutRef, - ref, - renderLanes, - ); - hasId = checkDidRenderIdHook(); - } + + const nextChildren = renderWithHooks( + current, + workInProgress, + render, + propsWithoutRef, + ref, + renderLanes, + ); + const hasId = checkDidRenderIdHook(); + if (enableSchedulingProfiler) { markComponentRenderStopped(); } @@ -1133,33 +1121,21 @@ function updateFunctionComponent( context = getMaskedContext(workInProgress, unmaskedContext); } - let nextChildren; - let hasId; prepareToReadContext(workInProgress, renderLanes); if (enableSchedulingProfiler) { markComponentRenderStarted(workInProgress); } - if (__DEV__) { - nextChildren = renderWithHooks( - current, - workInProgress, - Component, - nextProps, - context, - renderLanes, - ); - hasId = checkDidRenderIdHook(); - } else { - nextChildren = renderWithHooks( - current, - workInProgress, - Component, - nextProps, - context, - renderLanes, - ); - hasId = checkDidRenderIdHook(); - } + + const nextChildren = renderWithHooks( + current, + workInProgress, + Component, + nextProps, + context, + renderLanes, + ); + const hasId = checkDidRenderIdHook(); + if (enableSchedulingProfiler) { markComponentRenderStopped(); }