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.
This commit is contained in:
yungsters
2024-05-29 03:41:30 +00:00
parent ca3d324212
commit c484123b68
3 changed files with 7 additions and 7 deletions
@@ -1 +1 @@
163122766b6008e992898b00f1fe3b104ed78737
3b29ed16386c1afb2e76c3db0d576184154ec141
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e788833561fd15923c3878d11f308805>>
* @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');
}
@@ -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');
}