fix(runtime-core/scheduler): invalidate job (#717)
This commit is contained in:
parent
f4c54a888b
commit
fe9da2d0e4
@ -246,12 +246,20 @@ describe('scheduler', () => {
|
||||
const job2 = () => {
|
||||
calls.push('job2')
|
||||
}
|
||||
// queue both jobs
|
||||
const job3 = () => {
|
||||
calls.push('job3')
|
||||
}
|
||||
const job4 = () => {
|
||||
calls.push('job4')
|
||||
}
|
||||
// queue all jobs
|
||||
queueJob(job1)
|
||||
queueJob(job2)
|
||||
queueJob(job3)
|
||||
queuePostFlushCb(job4)
|
||||
expect(calls).toEqual([])
|
||||
await nextTick()
|
||||
// job2 should be called only once
|
||||
expect(calls).toEqual(['job1', 'job2'])
|
||||
expect(calls).toEqual(['job1', 'job2', 'job3', 'job4'])
|
||||
})
|
||||
})
|
||||
|
@ -70,7 +70,7 @@ function flushJobs(seen?: CountMap) {
|
||||
if (__DEV__) {
|
||||
seen = seen || new Map()
|
||||
}
|
||||
while ((job = queue.shift())) {
|
||||
while ((job = queue.shift()) !== undefined) {
|
||||
if (job === null) {
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user