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 CoreRuntime Instance calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  f10291d3_36ff_88b8_ea51_0c73b3e62367["updateChildComponent()"]
  f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"]
  f10291d3_36ff_88b8_ea51_0c73b3e62367 -->|defined in| f3560440_54c1_5663_36f8_c7de54d7310b
  e0ef4bb3_9635_a4a3_0fe6_ebbefa4d00f1["componentVNodeHooks.prepatch()"]
  e0ef4bb3_9635_a4a3_0fe6_ebbefa4d00f1 -->|calls| f10291d3_36ff_88b8_ea51_0c73b3e62367
  7c8c6406_e098_edbf_9f4d_d068527deff1["updateComponentListeners()"]
  f10291d3_36ff_88b8_ea51_0c73b3e62367 -->|calls| 7c8c6406_e098_edbf_9f4d_d068527deff1
  2bcc88b5_db8a_b047_2abd_7382948898ab["toggleObserving()"]
  f10291d3_36ff_88b8_ea51_0c73b3e62367 -->|calls| 2bcc88b5_db8a_b047_2abd_7382948898ab
  23d9ce46_8163_f008_2464_0fc0040f465c["resolveSlots()"]
  f10291d3_36ff_88b8_ea51_0c73b3e62367 -->|calls| 23d9ce46_8163_f008_2464_0fc0040f465c
  style f10291d3_36ff_88b8_ea51_0c73b3e62367 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