From: HcySunYang Date: Wed, 3 Feb 2021 18:28:07 +0000 (+0800) Subject: perf(reactivity): should not track `__isVue` (#2940) X-Git-Tag: v3.0.6~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd02cf37d5f5a6946bcae01ee70568e38a82c177;p=thirdparty%2Fvuejs%2Fcore.git perf(reactivity): should not track `__isVue` (#2940) --- diff --git a/packages/reactivity/src/baseHandlers.ts b/packages/reactivity/src/baseHandlers.ts index 5f57a3c9f9..694893265b 100644 --- a/packages/reactivity/src/baseHandlers.ts +++ b/packages/reactivity/src/baseHandlers.ts @@ -22,10 +22,13 @@ import { hasChanged, isArray, isIntegerKey, - extend + extend, + makeMap } from '@vue/shared' import { isRef } from './ref' +const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`) + const builtInSymbols = new Set( Object.getOwnPropertyNames(Symbol) .map(key => (Symbol as any)[key]) @@ -93,7 +96,7 @@ function createGetter(isReadonly = false, shallow = false) { if ( isSymbol(key) ? builtInSymbols.has(key as symbol) - : key === `__proto__` || key === `__v_isRef` + : isNonTrackableKeys(key) ) { return res }