This commit is contained in:
2022-09-13 11:03:40 +08:00
23 changed files with 150 additions and 140 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)
})
})

View File

@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-core",
"version": "3.2.38",
"version": "3.2.39",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.2.38",
"@vue/reactivity": "3.2.38"
"@vue/shared": "3.2.39",
"@vue/reactivity": "3.2.39"
}
}

View File

@@ -133,7 +133,11 @@ export function queuePostFlushCb(cb: SchedulerJobs) {
queueFlush()
}
export function flushPreFlushCbs(seen?: CountMap, i = flushIndex) {
export function flushPreFlushCbs(
seen?: CountMap,
// if currently flushing, skip the current job itself
i = isFlushing ? flushIndex + 1 : 0
) {
if (__DEV__) {
seen = seen || new Map()
}