Skip to content

Commit

Permalink
refactor: use Number constructor when coercing array length
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Nov 14, 2022
1 parent 3427052 commit efa2ac5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/reactivity/src/effect.ts
@@ -1,5 +1,5 @@
import { TrackOpTypes, TriggerOpTypes } from './operations'
import { extend, isArray, isIntegerKey, isMap, toNumber } from '@vue/shared'
import { extend, isArray, isIntegerKey, isMap } from '@vue/shared'
import { EffectScope, recordEffectScope } from './effectScope'
import {
createDep,
Expand Down Expand Up @@ -276,7 +276,7 @@ export function trigger(
// trigger all effects for target
deps = [...depsMap.values()]
} else if (key === 'length' && isArray(target)) {
const newLength = toNumber(newValue)
const newLength = Number(newValue)
depsMap.forEach((dep, key) => {
if (key === 'length' || key >= newLength) {
deps.push(dep)
Expand Down

0 comments on commit efa2ac5

Please sign in to comment.