MCPcopy
hub / github.com/vuejs/core / hydrateFragment

Function hydrateFragment

packages/runtime-core/src/hydration.ts:648–684  ·  view source on GitHub ↗
(
    node: Comment,
    vnode: VNode,
    parentComponent: ComponentInternalInstance | null,
    parentSuspense: SuspenseBoundary | null,
    slotScopeIds: string[] | null,
    optimized: boolean,
  )

Source from the content-addressed store, hash-verified

646 }
647
648 const hydrateFragment = (
649 node: Comment,
650 vnode: VNode,
651 parentComponent: ComponentInternalInstance | null,
652 parentSuspense: SuspenseBoundary | null,
653 slotScopeIds: string[] | null,
654 optimized: boolean,
655 ) => {
656 const { slotScopeIds: fragmentSlotScopeIds } = vnode
657 if (fragmentSlotScopeIds) {
658 slotScopeIds = slotScopeIds
659 ? slotScopeIds.concat(fragmentSlotScopeIds)
660 : fragmentSlotScopeIds
661 }
662
663 const container = parentNode(node)!
664 const next = hydrateChildren(
665 nextSibling(node)!,
666 vnode,
667 container,
668 parentComponent,
669 parentSuspense,
670 slotScopeIds,
671 optimized,
672 )
673 if (next && isComment(next) && next.data === ']') {
674 return nextSibling((vnode.anchor = next))
675 } else {
676 // fragment didn't hydrate successfully, since we didn't get a end anchor
677 // back. This should have led to node/children mismatch warnings.
678 logMismatchError()
679
680 // since the anchor is missing, we need to create one and insert it
681 insert((vnode.anchor = createComment(`]`)), container, next)
682 return next
683 }
684 }
685
686 const handleMismatch = (
687 node: Node,

Callers 1

hydrateNodeFunction · 0.85

Calls 7

parentNodeFunction · 0.85
hydrateChildrenFunction · 0.85
nextSiblingFunction · 0.85
logMismatchErrorFunction · 0.85
insertFunction · 0.85
createCommentFunction · 0.85
isCommentFunction · 0.70

Tested by

no test coverage detected