Home / Function/ flushSchedulerQueue() — vue Function Reference

flushSchedulerQueue() — vue Function Reference

Architecture documentation for the flushSchedulerQueue() function in scheduler.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec["flushSchedulerQueue()"]
  a5f84bab_9034_ce7b_6911_25c506039541["queueWatcher()"]
  a5f84bab_9034_ce7b_6911_25c506039541 -->|calls| 9ee171a6_a4b8_25d2_3782_d5fdbe38bfec
  87c5535f_5c72_fd55_6a79_7cd271ebdcdf["getNow()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| 87c5535f_5c72_fd55_6a79_7cd271ebdcdf
  df67762e_53ee_05bf_1358_c48dd0fc8f8d["run()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| df67762e_53ee_05bf_1358_c48dd0fc8f8d
  09e945ec_d0bf_3e0c_98aa_bc66000bfd61["resetSchedulerState()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| 09e945ec_d0bf_3e0c_98aa_bc66000bfd61
  47074b77_66f0_eb70_22b7_c50e95d3acc7["callActivatedHooks()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| 47074b77_66f0_eb70_22b7_c50e95d3acc7
  911c0742_8b4d_52ad_2f13_f18a8cc327ff["callUpdatedHooks()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| 911c0742_8b4d_52ad_2f13_f18a8cc327ff
  12ec28f6_876b_9f0a_7041_d93bca97acc0["cleanupDeps()"]
  9ee171a6_a4b8_25d2_3782_d5fdbe38bfec -->|calls| 12ec28f6_876b_9f0a_7041_d93bca97acc0
  style 9ee171a6_a4b8_25d2_3782_d5fdbe38bfec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/observer/scheduler.ts lines 74–131

function flushSchedulerQueue() {
  currentFlushTimestamp = getNow()
  flushing = true
  let watcher, id

  // Sort queue before flush.
  // This ensures that:
  // 1. Components are updated from parent to child. (because parent is always
  //    created before the child)
  // 2. A component's user watchers are run before its render watcher (because
  //    user watchers are created before the render watcher)
  // 3. If a component is destroyed during a parent component's watcher run,
  //    its watchers can be skipped.
  queue.sort(sortCompareFn)

  // do not cache length because more watchers might be pushed
  // as we run existing watchers
  for (index = 0; index < queue.length; index++) {
    watcher = queue[index]
    if (watcher.before) {
      watcher.before()
    }
    id = watcher.id
    has[id] = null
    watcher.run()
    // in dev build, check and stop circular updates.
    if (__DEV__ && has[id] != null) {
      circular[id] = (circular[id] || 0) + 1
      if (circular[id] > MAX_UPDATE_COUNT) {
        warn(
          'You may have an infinite update loop ' +
            (watcher.user
              ? `in watcher with expression "${watcher.expression}"`
              : `in a component render function.`),
          watcher.vm
        )
        break
      }
    }
  }

  // keep copies of post queues before resetting state
  const activatedQueue = activatedChildren.slice()
  const updatedQueue = queue.slice()

  resetSchedulerState()

  // call component updated and activated hooks
  callActivatedHooks(activatedQueue)
  callUpdatedHooks(updatedQueue)
  cleanupDeps()

  // devtool hook
  /* istanbul ignore if */
  if (devtools && config.devtools) {
    devtools.emit('flush')
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does flushSchedulerQueue() do?
flushSchedulerQueue() is a function in the vue codebase.
What does flushSchedulerQueue() call?
flushSchedulerQueue() calls 6 function(s): callActivatedHooks, callUpdatedHooks, cleanupDeps, getNow, resetSchedulerState, run.
What calls flushSchedulerQueue()?
flushSchedulerQueue() is called by 1 function(s): queueWatcher.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free