fix(watch): avoid traversing non-plain objects
This commit is contained in:
parent
f6dee53270
commit
62b8f4a39c
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user