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.
  • Loading branch information
yungsters committed May 29, 2024
1 parent b44263a commit 3b29ed1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
export function findNodeHandle(componentOrHandle: any): ?number {
if (__DEV__) {
const owner = currentOwner;
if (owner !== null && owner.stateNode !== null) {
if (owner !== null && isRendering && owner.stateNode !== null) {
if (!owner.stateNode._warnedAboutRefsInRender) {
console.error(
'%s is accessing findNodeHandle inside its render(). ' +
Expand Down

0 comments on commit 3b29ed1

Please sign in to comment.