diff --git a/.vscode/launch.json b/.vscode/launch.json index c4ffd0fc5c3..6a86d1c149e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,7 +19,8 @@ "NODE_ENV": "development" }, "console": "integratedTerminal", - "sourceMaps": true + "sourceMaps": true, + "skipFiles": ["", "node_modules"] } ] } diff --git a/packages/reactivity/src/effect.ts b/packages/reactivity/src/effect.ts index 010aea0020a..6e1fd27893f 100644 --- a/packages/reactivity/src/effect.ts +++ b/packages/reactivity/src/effect.ts @@ -194,13 +194,14 @@ export function trigger( addRunners(effects, computedRunners, depsMap.get(key)) } // also run for iteration key on ADD | DELETE | Map.SET - if ( - type === TriggerOpTypes.ADD || + if (type === TriggerOpTypes.ADD) { + const iterationKey = isArray(target) ? 'length' : ITERATE_KEY + addRunners(effects, computedRunners, depsMap.get(iterationKey)) + } else if ( type === TriggerOpTypes.DELETE || (type === TriggerOpTypes.SET && target instanceof Map) ) { - const iterationKey = isArray(target) ? 'length' : ITERATE_KEY - addRunners(effects, computedRunners, depsMap.get(iterationKey)) + addRunners(effects, computedRunners, depsMap.get(ITERATE_KEY)) } } const run = (effect: ReactiveEffect) => {