NOTIFIED = 1 << 3,
DIRTY = 1 << 4,
ALLOW_RECURSE = 1 << 5,
- NO_BATCH = 1 << 6,
- PAUSED = 1 << 7,
+ PAUSED = 1 << 6,
}
/**
) {
return
}
- if (this.flags & EffectFlags.NO_BATCH) {
- return this.trigger()
- }
if (!(this.flags & EffectFlags.NOTIFIED)) {
this.flags |= EffectFlags.NOTIFIED
this.nextEffect = batchedEffect
return
}
+ batchDepth--
let error: unknown
while (batchedEffect) {
let e: ReactiveEffect | undefined = batchedEffect
}
}
- batchDepth--
if (error) throw error
}
warn.mockRestore()
})
+
+ it('should be executed correctly', () => {
+ const v = ref(1)
+ let foo = ''
+
+ watch(
+ v,
+ () => {
+ foo += '1'
+ },
+ {
+ flush: 'sync',
+ },
+ )
+ watch(
+ v,
+ () => {
+ foo += '2'
+ },
+ {
+ flush: 'sync',
+ },
+ )
+
+ expect(foo).toBe('')
+ v.value++
+ expect(foo).toBe('12')
+ })
})
let scheduler: EffectScheduler
if (flush === 'sync') {
- effect.flags |= EffectFlags.NO_BATCH
scheduler = job as any // the scheduler function gets called directly
} else if (flush === 'post') {
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense)