refactor(runtime-core): simplify deep watch traverse (#2212)

This commit is contained in:
Pick 2020-10-14 04:06:36 +08:00 committed by GitHub
parent e2c9ab1991
commit 9b34f915ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -333,13 +333,8 @@ function traverse(value: unknown, seen: Set<unknown> = new Set()) {
for (let i = 0; i < value.length; i++) {
traverse(value[i], seen)
}
} else if (isMap(value)) {
value.forEach((_, key) => {
// to register mutation dep for existing keys
traverse(value.get(key), seen)
})
} else if (isSet(value)) {
value.forEach(v => {
} else if (isSet(value) || isMap(value)) {
value.forEach((v: any) => {
traverse(v, seen)
})
} else {