let isFlushing = false
let isFlushPending = false
-const queue: (SchedulerJob | null)[] = []
+const queue: SchedulerJob[] = []
let flushIndex = 0
const pendingPreFlushCbs: SchedulerCb[] = []
export function invalidateJob(job: SchedulerJob) {
const i = queue.indexOf(job)
if (i > -1) {
- queue[i] = null
+ queue.splice(i, 1)
}
}
// priority number)
// 2. If a component is unmounted during a parent component's update,
// its update can be skipped.
- // Jobs can never be null before flush starts, since they are only invalidated
- // during execution of another flushed job.
- queue.sort((a, b) => getId(a!) - getId(b!))
+ queue.sort((a, b) => getId(a) - getId(b))
try {
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {