From 39cad7afc43fcbca1fd2e3a0d5b7706c8b237793 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 11 Apr 2025 14:39:36 -0700 Subject: [PATCH] Remove redundant __DEV__ condition (#32810) It used to be that in `__DEV__` we wrapped this `renderWithHooks`, `checkDidRenderIdHook` pair in calls to `setIsRendering()`. However, that dev-only bookkeeping was removed in https://github.com/facebook/react/pull/29206 leaving this redundant check which runs identical code in dev and in prod. ## Test Plan * Manually confirm both cases are the same * GitHub CI tests --- .../src/ReactFiberBeginWork.js | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index b8e753dc03..fc5019b2ff 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -436,33 +436,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(); }