From c9d64e5f4c2b7cc70a618eec78900dbfd6d201e8 Mon Sep 17 00:00:00 2001 From: Behnam Mohammadi Date: Mon, 27 Sep 2021 16:26:56 +0330 Subject: [PATCH] add hasOwnProperty to devTools backend (#22437) --- .../react-devtools-shared/src/backend/renderer.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 19279cbaf565e..78953e72979a4 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -85,6 +85,7 @@ import {format} from './utils'; import {enableProfilerChangedHookIndices} from 'react-devtools-feature-flags'; import is from 'shared/objectIs'; import isArray from 'shared/isArray'; +import hasOwnProperty from 'shared/hasOwnProperty'; import type {Fiber} from 'react-reconciler/src/ReactInternalTypes'; import type { @@ -1380,13 +1381,13 @@ export function attach( return false; } const {deps} = memoizedState; - const hasOwnProperty = Object.prototype.hasOwnProperty.bind(memoizedState); + const boundHasOwnProperty = hasOwnProperty.bind(memoizedState); return ( - hasOwnProperty('create') && - hasOwnProperty('destroy') && - hasOwnProperty('deps') && - hasOwnProperty('next') && - hasOwnProperty('tag') && + boundHasOwnProperty('create') && + boundHasOwnProperty('destroy') && + boundHasOwnProperty('deps') && + boundHasOwnProperty('next') && + boundHasOwnProperty('tag') && (deps === null || isArray(deps)) ); }