Home / Function/ updateChildComponent() — vue Function Reference

updateChildComponent() — vue Function Reference

Architecture documentation for the updateChildComponent() function in lifecycle.ts from the vue codebase.

Function typescript VueCore Instance calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  055f956d_f3e0_f8ad_f06a_a9b3085eb888["updateChildComponent()"]
  d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"]
  055f956d_f3e0_f8ad_f06a_a9b3085eb888 -->|defined in| d937f76e_061f_a631_9587_336503c9a15c
  ff4fa1dd_de75_4f12_4e02_24651d72a824["componentVNodeHooks.prepatch()"]
  ff4fa1dd_de75_4f12_4e02_24651d72a824 -->|calls| 055f956d_f3e0_f8ad_f06a_a9b3085eb888
  6c50385e_3899_8a29_64e2_f9413ff2ef02["updateComponentListeners()"]
  055f956d_f3e0_f8ad_f06a_a9b3085eb888 -->|calls| 6c50385e_3899_8a29_64e2_f9413ff2ef02
  c9e94feb_048a_387e_29a1_1567a76d119c["toggleObserving()"]
  055f956d_f3e0_f8ad_f06a_a9b3085eb888 -->|calls| c9e94feb_048a_387e_29a1_1567a76d119c
  104d091a_5520_5f91_df65_4a79135c9791["resolveSlots()"]
  055f956d_f3e0_f8ad_f06a_a9b3085eb888 -->|calls| 104d091a_5520_5f91_df65_4a79135c9791
  style 055f956d_f3e0_f8ad_f06a_a9b3085eb888 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/instance/lifecycle.ts lines 246–351

export function updateChildComponent(
  vm: Component,
  propsData: Record<string, any> | null | undefined,
  listeners: Record<string, Function | Array<Function>> | undefined,
  parentVnode: MountedComponentVNode,
  renderChildren?: Array<VNode> | null
) {
  if (__DEV__) {
    isUpdatingChildComponent = true
  }

  // determine whether component has slot children
  // we need to do this before overwriting $options._renderChildren.

  // check if there are dynamic scopedSlots (hand-written or compiled but with
  // dynamic slot names). Static scoped slots compiled from template has the
  // "$stable" marker.
  const newScopedSlots = parentVnode.data.scopedSlots
  const oldScopedSlots = vm.$scopedSlots
  const hasDynamicScopedSlot = !!(
    (newScopedSlots && !newScopedSlots.$stable) ||
    (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
    (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
    (!newScopedSlots && vm.$scopedSlots.$key)
  )

  // Any static slot children from the parent may have changed during parent's
  // update. Dynamic scoped slots may also have changed. In such cases, a forced
  // update is necessary to ensure correctness.
  let needsForceUpdate = !!(
    renderChildren || // has new static slots
    vm.$options._renderChildren || // has old static slots
    hasDynamicScopedSlot
  )

  const prevVNode = vm.$vnode
  vm.$options._parentVnode = parentVnode
  vm.$vnode = parentVnode // update vm's placeholder node without re-render

  if (vm._vnode) {
    // update child tree's parent
    vm._vnode.parent = parentVnode
  }
  vm.$options._renderChildren = renderChildren

  // update $attrs and $listeners hash
  // these are also reactive so they may trigger child update if the child
  // used them during render
  const attrs = parentVnode.data.attrs || emptyObject
  if (vm._attrsProxy) {
    // force update if attrs are accessed and has changed since it may be
    // passed to a child component.
    if (
      syncSetupProxy(
        vm._attrsProxy,
        attrs,
        (prevVNode.data && prevVNode.data.attrs) || emptyObject,
        vm,
        '$attrs'
      )
    ) {
      needsForceUpdate = true
    }
  }
  vm.$attrs = attrs

  // update listeners
  listeners = listeners || emptyObject
  const prevListeners = vm.$options._parentListeners
  if (vm._listenersProxy) {
    syncSetupProxy(
      vm._listenersProxy,
      listeners,
      prevListeners || emptyObject,
      vm,
      '$listeners'
    )
  }
  vm.$listeners = vm.$options._parentListeners = listeners
  updateComponentListeners(vm, listeners, prevListeners)

Domain

Subdomains

Frequently Asked Questions

What does updateChildComponent() do?
updateChildComponent() is a function in the vue codebase, defined in src/core/instance/lifecycle.ts.
Where is updateChildComponent() defined?
updateChildComponent() is defined in src/core/instance/lifecycle.ts at line 246.
What does updateChildComponent() call?
updateChildComponent() calls 3 function(s): resolveSlots, toggleObserving, updateComponentListeners.
What calls updateChildComponent()?
updateChildComponent() is called by 1 function(s): componentVNodeHooks.prepatch.

Analyze Your Own Codebase

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

Try Supermodel Free