]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor(computed): deprecated computedRunners (#1458)
authorPick <pickchen@tencent.com>
Wed, 1 Jul 2020 19:39:13 +0000 (03:39 +0800)
committerGitHub <noreply@github.com>
Wed, 1 Jul 2020 19:39:13 +0000 (15:39 -0400)
packages/reactivity/src/computed.ts
packages/reactivity/src/effect.ts

index d6f89fe284ecdb24db4c1b20c02c38c073607944..611ecaefb566cb1378ca9b936e24df1ce93d81f0 100644 (file)
@@ -48,7 +48,6 @@ export function computed<T>(
   const runner = effect(getter, {
     lazy: true,
     // mark effect as computed so that it gets priority during trigger
-    computed: true,
     scheduler: () => {
       if (!dirty) {
         dirty = true
index c6187d296ee2046c94de030ab8d0d3aaa6976be7..98aff15ddbd3756081b90ec45d4dbc28b601f007 100644 (file)
@@ -177,16 +177,11 @@ export function trigger(
   }
 
   const effects = new Set<ReactiveEffect>()
-  const computedRunners = new Set<ReactiveEffect>()
   const add = (effectsToAdd: Set<ReactiveEffect> | 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)
 }