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 authored and chrislone committed Feb 4, 2023
1 parent c3f22c4 commit 8d637f6
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 8d637f6

Please sign in to comment.