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 VueCore Observer calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3["flushSchedulerQueue()"]
  36c7708b_24b4_08c9_e39f_50f332a4b206["scheduler.ts"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|defined in| 36c7708b_24b4_08c9_e39f_50f332a4b206
  b4e0d823_0133_d156_5392_8b2e8367ebd9["queueWatcher()"]
  b4e0d823_0133_d156_5392_8b2e8367ebd9 -->|calls| 07ee0e45_f4fc_db24_4b7f_12ba4b3026a3
  76c00935_35b9_f2e3_e1af_74574f7e7592["getNow()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| 76c00935_35b9_f2e3_e1af_74574f7e7592
  71876f35_b702_de2d_a393_99f72b820099["run()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| 71876f35_b702_de2d_a393_99f72b820099
  3f024659_3c73_38f4_7e6a_a5d30e34e583["resetSchedulerState()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| 3f024659_3c73_38f4_7e6a_a5d30e34e583
  6eea97d8_4fdd_6b45_e5f4_358cc1756362["callActivatedHooks()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| 6eea97d8_4fdd_6b45_e5f4_358cc1756362
  bcb31f89_65da_2298_fd9e_3da8b97459f3["callUpdatedHooks()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| bcb31f89_65da_2298_fd9e_3da8b97459f3
  e284d477_da35_6b60_95cf_55ca5a80225b["cleanupDeps()"]
  07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 -->|calls| e284d477_da35_6b60_95cf_55ca5a80225b
  style 07ee0e45_f4fc_db24_4b7f_12ba4b3026a3 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