Skip to content

Commit

Permalink
fix(watch): avoid traversing non-plain objects
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 20, 2021
1 parent f6dee53 commit 62b8f4a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/runtime-core/src/apiWatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
NOOP,
remove,
isMap,
isSet
isSet,
isPlainObject
} from '@vue/shared'
import {
currentInstance,
Expand Down Expand Up @@ -391,9 +392,9 @@ function traverse(value: unknown, seen: Set<unknown> = new Set()) {
value.forEach((v: any) => {
traverse(v, seen)
})
} else {
} else if (isPlainObject(value)) {
for (const key in value) {
traverse(value[key], seen)
traverse((value as any)[key], seen)
}
}
return value
Expand Down

0 comments on commit 62b8f4a

Please sign in to comment.