Skip to content

Commit

Permalink
refactor: move toNumber call out of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Oct 26, 2022
1 parent 8e792d9 commit d9de6ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/reactivity/src/effect.ts
Expand Up @@ -276,8 +276,9 @@ export function trigger(
// trigger all effects for target
deps = [...depsMap.values()]
} else if (key === 'length' && isArray(target)) {
const newLength = toNumber(newValue)
depsMap.forEach((dep, key) => {
if (key === 'length' || key >= toNumber(newValue)) {
if (key === 'length' || key >= newLength) {
deps.push(dep)
}
})
Expand Down

0 comments on commit d9de6ca

Please sign in to comment.