From 5c490f1c45416fbaff97024226ca423cd2c67ed0 Mon Sep 17 00:00:00 2001 From: Pick Date: Thu, 2 Jul 2020 03:39:13 +0800 Subject: [PATCH] refactor(computed): deprecated computedRunners (#1458) --- packages/reactivity/src/computed.ts | 1 - packages/reactivity/src/effect.ts | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/reactivity/src/computed.ts b/packages/reactivity/src/computed.ts index d6f89fe2..611ecaef 100644 --- a/packages/reactivity/src/computed.ts +++ b/packages/reactivity/src/computed.ts @@ -48,7 +48,6 @@ export function computed( const runner = effect(getter, { lazy: true, // mark effect as computed so that it gets priority during trigger - computed: true, scheduler: () => { if (!dirty) { dirty = true diff --git a/packages/reactivity/src/effect.ts b/packages/reactivity/src/effect.ts index c6187d29..98aff15d 100644 --- a/packages/reactivity/src/effect.ts +++ b/packages/reactivity/src/effect.ts @@ -177,16 +177,11 @@ export function trigger( } const effects = new Set() - const computedRunners = new Set() const add = (effectsToAdd: Set | undefined) => { if (effectsToAdd) { effectsToAdd.forEach(effect => { if (effect !== activeEffect || !shouldTrack) { - if (effect.options.computed) { - computedRunners.add(effect) - } else { - effects.add(effect) - } + effects.add(effect) } else { // the effect mutated its own dependency during its execution. // this can be caused by operations like foo.value++ @@ -245,8 +240,5 @@ export function trigger( } } - // Important: computed effects must be run first so that computed getters - // can be invalidated before any normal effects that depend on them are run. - computedRunners.forEach(run) effects.forEach(run) }