}
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++
}
}
- // 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)
}