fix(runtime-core): avoid double firing when mounting inside a watcher callback

fix #6614
This commit is contained in:
Evan You
2022-09-08 09:59:51 +08:00
parent 6493da5bfa
commit 6aaf8efeff
2 changed files with 17 additions and 1 deletions

View File

@@ -534,4 +534,16 @@ describe('scheduler', () => {
// should not be called
expect(spy).toHaveBeenCalledTimes(0)
})
it('flushPreFlushCbs inside a pre job', async () => {
const spy = jest.fn()
const job = () => {
spy()
flushPreFlushCbs()
}
job.pre = true
queueJob(job)
await nextTick()
expect(spy).toHaveBeenCalledTimes(1)
})
})