Explorar el Código

fix(reactivity): effect should still check sync self-trigger

Evan You hace 5 años
padre
commit
ac81dcf
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      packages/reactivity/src/effect.ts

+ 5 - 1
packages/reactivity/src/effect.ts

@@ -178,7 +178,11 @@ export function trigger(
   const effects = new Set<ReactiveEffect>()
   const add = (effectsToAdd: Set<ReactiveEffect> | undefined) => {
     if (effectsToAdd) {
-      effectsToAdd.forEach(effect => effects.add(effect))
+      effectsToAdd.forEach(effect => {
+        if (effect !== activeEffect) {
+          effects.add(effect)
+        }
+      })
     }
   }