From c484123b68ebd070e92e4e628fc36afde08553cf Mon Sep 17 00:00:00 2001 From: yungsters Date: Wed, 29 May 2024 03:41:30 +0000 Subject: [PATCH] Fix "findNodeHandle inside its render()" False Positive Warning (#29627) This was missed in https://github.com/facebook/react/pull/29038 when unifying the "owner" abstractions, causing `findNodeHandle` to warn even outside of `render()` invocations. DiffTrain build for commit https://github.com/facebook/react/commit/3b29ed16386c1afb2e76c3db0d576184154ec141. --- .../js/react-native-github/Libraries/Renderer/REVISION | 2 +- .../Renderer/implementations/ReactFabric-dev.fb.js | 6 +++--- .../Renderer/implementations/ReactNativeRenderer-dev.fb.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 5e1e837b6dbb4..cbac417ee5afc 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -163122766b6008e992898b00f1fe3b104ed78737 +3b29ed16386c1afb2e76c3db0d576184154ec141 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 46acb4f0fde0c..020a5b98a23f2 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<10cfb47da57f40f3c6d1aaf8620d48a4>> */ 'use strict'; @@ -26212,7 +26212,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-rc-e4976d97'; +var ReactVersion = '19.0.0-rc-76d74f41'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -26799,7 +26799,7 @@ function findNodeHandle(componentOrHandle) { { var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { error('%s is accessing findNodeHandle inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromType(owner.type) || 'A component'); } diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index e4ca353b1c6e5..ce7d5a4f5b208 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<40a0e1ce33bc52f3d6d9fc7ae12f7651>> + * @generated SignedSource<<0d778c4f67b7a3562c3dae6ebc4f0c47>> */ 'use strict'; @@ -26562,7 +26562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-rc-a40621a5'; +var ReactVersion = '19.0.0-rc-068dfbff'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -27143,7 +27143,7 @@ function findNodeHandle(componentOrHandle) { { var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { error('%s is accessing findNodeHandle inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromType(owner.type) || 'A component'); }