Skip to content

Commit

Permalink
fix(watch): avoid traversing objects that are marked non-reactive
Browse files Browse the repository at this point in the history
e.g. Vue public instances
  • Loading branch information
yyx990803 committed Jun 2, 2021
1 parent 51d2be2 commit 9acc9a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/runtime-core/src/apiWatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
Ref,
ComputedRef,
ReactiveEffectOptions,
isReactive
isReactive,
ReactiveFlags
} from '@vue/reactivity'
import { SchedulerJob, queuePreFlushCb } from './scheduler'
import {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9acc9a1

Please sign in to comment.