]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: remove unnecessary conditions and test case
authorEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 16:09:03 +0000 (12:09 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 16:26:14 +0000 (12:26 -0400)
packages/reactivity/__tests__/effect.spec.ts
packages/reactivity/src/effect.ts

index 7285bb539ed833ffa5d302ed77e22fab904b2589..87b85292357d3ac2dafab532609d0ffac8364d15 100644 (file)
@@ -6,8 +6,7 @@ import {
   TrackOpTypes,
   TriggerOpTypes,
   DebuggerEvent,
-  markRaw,
-  ref
+  markRaw
 } from '../src/index'
 import { ITERATE_KEY } from '../src/effect'
 
@@ -782,14 +781,4 @@ describe('reactivity/effect', () => {
     expect(dummy).toBe(0)
     expect(record).toBeUndefined()
   })
-
-  it('should handle self dependency mutations', () => {
-    const count = ref(0)
-    effect(() => {
-      count.value++
-    })
-    expect(count.value).toBe(1)
-    count.value = 10
-    expect(count.value).toBe(11)
-  })
 })
index eb06a63a59d898dc9c20a4c74eebe97de9dd666c..95576166e00a86dd237b257e0638b9ebea2af05d 100644 (file)
@@ -178,15 +178,7 @@ export function trigger(
   const effects = new Set<ReactiveEffect>()
   const add = (effectsToAdd: Set<ReactiveEffect> | undefined) => {
     if (effectsToAdd) {
-      effectsToAdd.forEach(effect => {
-        if (effect !== activeEffect || !shouldTrack) {
-          effects.add(effect)
-        } else {
-          // the effect mutated its own dependency during its execution.
-          // this can be caused by operations like foo.value++
-          // do not trigger or we end in an infinite loop
-        }
-      })
+      effectsToAdd.forEach(effect => effects.add(effect))
     }
   }