Skip to content

Commit

Permalink
Fix "findNodeHandle inside its render()" False Positive Warning (#29627)
Browse files Browse the repository at this point in the history
This was missed in #29038 when
unifying the "owner" abstractions, causing `findNodeHandle` to warn even
outside of `render()` invocations.

DiffTrain build for commit 3b29ed1.
  • Loading branch information
yungsters committed May 29, 2024
1 parent ca3d324 commit c484123
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
163122766b6008e992898b00f1fe3b104ed78737
3b29ed16386c1afb2e76c3db0d576184154ec141
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e788833561fd15923c3878d11f308805>>
* @generated SignedSource<<10cfb47da57f40f3c6d1aaf8620d48a4>>
*/

'use strict';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<40a0e1ce33bc52f3d6d9fc7ae12f7651>>
* @generated SignedSource<<0d778c4f67b7a3562c3dae6ebc4f0c47>>
*/

'use strict';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
Expand Down

0 comments on commit c484123

Please sign in to comment.