From: Evan You Date: Wed, 2 Jun 2021 19:51:27 +0000 (-0400) Subject: fix(watch): avoid traversing objects that are marked non-reactive X-Git-Tag: v3.1.0-beta.7~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9acc9a1fa838bdcdf673d2f7cc3f996b2b69ffbc;p=thirdparty%2Fvuejs%2Fcore.git fix(watch): avoid traversing objects that are marked non-reactive e.g. Vue public instances --- diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index eaa699ce7b..b7092248e2 100644 --- a/packages/runtime-core/src/apiWatch.ts +++ b/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 = new Set()) { - if (!isObject(value) || seen.has(value)) { + if ( + !isObject(value) || + seen.has(value) || + (value as any)[ReactiveFlags.SKIP] + ) { return value } seen.add(value)