fix(runtime-core/scheduler): avoid duplicate updates of child component
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
|
||||
import { isArray } from '@vue/shared'
|
||||
|
||||
const queue: Function[] = []
|
||||
const queue: (Function | null)[] = []
|
||||
const postFlushCbs: Function[] = []
|
||||
const p = Promise.resolve()
|
||||
|
||||
@@ -22,6 +22,13 @@ export function queueJob(job: () => void) {
|
||||
}
|
||||
}
|
||||
|
||||
export function invalidateJob(job: () => void) {
|
||||
const i = queue.indexOf(job)
|
||||
if (i > -1) {
|
||||
queue[i] = null
|
||||
}
|
||||
}
|
||||
|
||||
export function queuePostFlushCb(cb: Function | Function[]) {
|
||||
if (!isArray(cb)) {
|
||||
postFlushCbs.push(cb)
|
||||
@@ -64,6 +71,9 @@ function flushJobs(seen?: CountMap) {
|
||||
seen = seen || new Map()
|
||||
}
|
||||
while ((job = queue.shift())) {
|
||||
if (job === null) {
|
||||
continue
|
||||
}
|
||||
if (__DEV__) {
|
||||
checkRecursiveUpdates(seen!, job)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user