From bfaeb4a46175fa0f4edf2eba58349d5029e5e86e Mon Sep 17 00:00:00 2001 From: 0xFango Date: Fri, 23 May 2025 09:02:39 +0700 Subject: [PATCH] Fix incorrect use of NoLanes in executionContext check (#33170) ## Summary This PR fixes a likely incorrect condition in the `scheduleUpdateOnFiber` function inside `ReactFiberWorkLoop.js`. Previously, the code checked: ```js (executionContext & RenderContext) !== NoLanes ```` However, `NoLanes` is part of the lane priority system, not the execution context flags. The intent here seems to be to detect whether the current execution context includes `RenderContext`, which should be compared against `NoContext`, not `NoLanes`. This fix replaces `NoLanes` with `NoContext` for semantic correctness and consistency with other checks throughout the codebase. **Fixes [[#33169](https://github.com/facebook/react/issues/33169)](https://github.com/facebook/react/issues/33169)** --- ## How did you test this change? I ran the following commands to validate correctness and ensure nothing was broken: * `yarn lint` * `yarn linc` * `yarn test` * `yarn test --prod` * `yarn flow` * `yarn prettier` All checks passed. Since this is a minor internal logic fix and doesn't change public behavior or APIs, no additional tests are necessary at this time. --- packages/react-reconciler/src/ReactFiberWorkLoop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index ecf22aaad04..fd746209756 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -908,7 +908,7 @@ export function scheduleUpdateOnFiber( markRootUpdated(root, lane); if ( - (executionContext & RenderContext) !== NoLanes && + (executionContext & RenderContext) !== NoContext && root === workInProgressRoot ) { // This update was dispatched during the render phase. This is a mistake