refactor: use Number constructor when coercing array length
This commit is contained in:
parent
3427052229
commit
efa2ac54d9
|
@ -1,5 +1,5 @@
|
||||||
import { TrackOpTypes, TriggerOpTypes } from './operations'
|
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 { EffectScope, recordEffectScope } from './effectScope'
|
||||||
import {
|
import {
|
||||||
createDep,
|
createDep,
|
||||||
|
@ -276,7 +276,7 @@ export function trigger(
|
||||||
// trigger all effects for target
|
// trigger all effects for target
|
||||||
deps = [...depsMap.values()]
|
deps = [...depsMap.values()]
|
||||||
} else if (key === 'length' && isArray(target)) {
|
} else if (key === 'length' && isArray(target)) {
|
||||||
const newLength = toNumber(newValue)
|
const newLength = Number(newValue)
|
||||||
depsMap.forEach((dep, key) => {
|
depsMap.forEach((dep, key) => {
|
||||||
if (key === 'length' || key >= newLength) {
|
if (key === 'length' || key >= newLength) {
|
||||||
deps.push(dep)
|
deps.push(dep)
|
||||||
|
|
Loading…
Reference in New Issue