fix(watch): avoid traversing non-plain objects

This commit is contained in:
Evan You 2021-04-20 17:13:58 -04:00
parent f6dee53270
commit 62b8f4a39c

View File

@ -18,7 +18,8 @@ import {
NOOP, NOOP,
remove, remove,
isMap, isMap,
isSet isSet,
isPlainObject
} from '@vue/shared' } from '@vue/shared'
import { import {
currentInstance, currentInstance,
@ -391,9 +392,9 @@ function traverse(value: unknown, seen: Set<unknown> = new Set()) {
value.forEach((v: any) => { value.forEach((v: any) => {
traverse(v, seen) traverse(v, seen)
}) })
} else { } else if (isPlainObject(value)) {
for (const key in value) { for (const key in value) {
traverse(value[key], seen) traverse((value as any)[key], seen)
} }
} }
return value return value