Explorar o código

perf(reactivity): should not track `__isVue` (#2940)

HcySunYang %!s(int64=5) %!d(string=hai) anos
pai
achega
dd02cf37d5
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      packages/reactivity/src/baseHandlers.ts

+ 5 - 2
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
     }