Home / Function/ flushSchedulerQueue() — vue Function Reference

flushSchedulerQueue() — vue Function Reference

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

Function typescript CoreRuntime Observer calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec["flushSchedulerQueue()"]
  7cc5a667_1876_f28e_e26f_27fcdcba292e["scheduler.ts"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|defined in| 7cc5a667_1876_f28e_e26f_27fcdcba292e
  331094c1_856e_230e_e56a_5500d0a6236f["queueWatcher()"]
  331094c1_856e_230e_e56a_5500d0a6236f -->|calls| f5b111c0_f7e1_77b3_8a0f_5e97da3014ec
  2f45861c_5ff1_739b_0d3d_3f2a147dc27d["getNow()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| 2f45861c_5ff1_739b_0d3d_3f2a147dc27d
  a4fba0c0_c91e_f56f_3c69_5a18514bb8e1["run()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| a4fba0c0_c91e_f56f_3c69_5a18514bb8e1
  940969ff_8c7e_95eb_8472_15cb572e5706["resetSchedulerState()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| 940969ff_8c7e_95eb_8472_15cb572e5706
  631fda9c_cd56_d5a1_0408_8bc73fc68929["callActivatedHooks()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| 631fda9c_cd56_d5a1_0408_8bc73fc68929
  d58310dd_8787_86b4_93c2_433f1f914fad["callUpdatedHooks()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| d58310dd_8787_86b4_93c2_433f1f914fad
  198e3f5b_4bb7_1eb3_c0a6_ea8e51a6335d["cleanupDeps()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| 198e3f5b_4bb7_1eb3_c0a6_ea8e51a6335d
  style f5b111c0_f7e1_77b3_8a0f_5e97da3014ec 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, defined in src/core/observer/scheduler.ts.
Where is flushSchedulerQueue() defined?
flushSchedulerQueue() is defined in src/core/observer/scheduler.ts at line 74.
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