2
0
Эх сурвалжийг харах

fix(watch): avoid traversing objects that are marked non-reactive

e.g. Vue public instances
Evan You 4 жил өмнө
parent
commit
9acc9a1fa8

+ 7 - 2
packages/runtime-core/src/apiWatch.ts

@@ -5,7 +5,8 @@ import {
   Ref,
   ComputedRef,
   ReactiveEffectOptions,
-  isReactive
+  isReactive,
+  ReactiveFlags
 } from '@vue/reactivity'
 import { SchedulerJob, queuePreFlushCb } from './scheduler'
 import {
@@ -390,7 +391,11 @@ export function createPathGetter(ctx: any, path: string) {
 }
 
 function traverse(value: unknown, seen: Set<unknown> = new Set()) {
-  if (!isObject(value) || seen.has(value)) {
+  if (
+    !isObject(value) ||
+    seen.has(value) ||
+    (value as any)[ReactiveFlags.SKIP]
+  ) {
     return value
   }
   seen.add(value)