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

e.g. Vue public instances
This commit is contained in:
Evan You 2021-06-02 15:51:27 -04:00
parent 51d2be2038
commit 9acc9a1fa8

View File

@ -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)