Skip to content

Commit c484123

Browse files
committed
Fix "findNodeHandle inside its render()" False Positive Warning (#29627)
This was missed in #29038 when unifying the "owner" abstractions, causing `findNodeHandle` to warn even outside of `render()` invocations. DiffTrain build for commit 3b29ed1.
1 parent ca3d324 commit c484123

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
163122766b6008e992898b00f1fe3b104ed78737
1+
3b29ed16386c1afb2e76c3db0d576184154ec141

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<e788833561fd15923c3878d11f308805>>
10+
* @generated SignedSource<<10cfb47da57f40f3c6d1aaf8620d48a4>>
1111
*/
1212

1313
'use strict';
@@ -26212,7 +26212,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2621226212
return root;
2621326213
}
2621426214

26215-
var ReactVersion = '19.0.0-rc-e4976d97';
26215+
var ReactVersion = '19.0.0-rc-76d74f41';
2621626216

2621726217
/*
2621826218
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -26799,7 +26799,7 @@ function findNodeHandle(componentOrHandle) {
2679926799
{
2680026800
var owner = current;
2680126801

26802-
if (owner !== null && owner.stateNode !== null) {
26802+
if (owner !== null && isRendering && owner.stateNode !== null) {
2680326803
if (!owner.stateNode._warnedAboutRefsInRender) {
2680426804
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');
2680526805
}

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<40a0e1ce33bc52f3d6d9fc7ae12f7651>>
10+
* @generated SignedSource<<0d778c4f67b7a3562c3dae6ebc4f0c47>>
1111
*/
1212

1313
'use strict';
@@ -26562,7 +26562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2656226562
return root;
2656326563
}
2656426564

26565-
var ReactVersion = '19.0.0-rc-a40621a5';
26565+
var ReactVersion = '19.0.0-rc-068dfbff';
2656626566

2656726567
/*
2656826568
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -27143,7 +27143,7 @@ function findNodeHandle(componentOrHandle) {
2714327143
{
2714427144
var owner = current;
2714527145

27146-
if (owner !== null && owner.stateNode !== null) {
27146+
if (owner !== null && isRendering && owner.stateNode !== null) {
2714727147
if (!owner.stateNode._warnedAboutRefsInRender) {
2714827148
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');
2714927149
}

0 commit comments

Comments
 (0)