(seen?: CountMap)
| 212 | job.id == null ? (job.flags! & SchedulerJobFlags.PRE ? -1 : Infinity) : job.id |
| 213 | |
| 214 | function flushJobs(seen?: CountMap) { |
| 215 | if (__DEV__) { |
| 216 | seen = seen || new Map() |
| 217 | } |
| 218 | |
| 219 | // conditional usage of checkRecursiveUpdate must be determined out of |
| 220 | // try ... catch block since Rollup by default de-optimizes treeshaking |
| 221 | // inside try-catch. This can leave all warning code unshaked. Although |
| 222 | // they would get eventually shaken by a minifier like terser, some minifiers |
| 223 | // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610) |
| 224 | const check = __DEV__ |
| 225 | ? (job: SchedulerJob) => checkRecursiveUpdates(seen!, job) |
| 226 | : NOOP |
| 227 | |
| 228 | try { |
| 229 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { |
| 230 | const job = queue[flushIndex] |
| 231 | if (job && !(job.flags! & SchedulerJobFlags.DISPOSED)) { |
| 232 | if (__DEV__ && check(job)) { |
| 233 | continue |
| 234 | } |
| 235 | if (job.flags! & SchedulerJobFlags.ALLOW_RECURSE) { |
| 236 | job.flags! &= ~SchedulerJobFlags.QUEUED |
| 237 | } |
| 238 | callWithErrorHandling( |
| 239 | job, |
| 240 | job.i, |
| 241 | job.i ? ErrorCodes.COMPONENT_UPDATE : ErrorCodes.SCHEDULER, |
| 242 | ) |
| 243 | if (!(job.flags! & SchedulerJobFlags.ALLOW_RECURSE)) { |
| 244 | job.flags! &= ~SchedulerJobFlags.QUEUED |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | } finally { |
| 249 | // If there was an error we still need to clear the QUEUED flags |
| 250 | for (; flushIndex < queue.length; flushIndex++) { |
| 251 | const job = queue[flushIndex] |
| 252 | if (job) { |
| 253 | job.flags! &= ~SchedulerJobFlags.QUEUED |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | flushIndex = -1 |
| 258 | queue.length = 0 |
| 259 | |
| 260 | flushPostFlushCbs(seen) |
| 261 | |
| 262 | currentFlushPromise = null |
| 263 | // If new jobs have been added to either queue, keep flushing |
| 264 | if (queue.length || pendingPostFlushCbs.length) { |
| 265 | flushJobs(seen) |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) { |
| 271 | const count = seen.get(fn) || 0 |
nothing calls this directly
no test coverage detected