MCPcopy Index your code
hub / github.com/angular/angular / conditionallyAnnotateNodePath

Function conditionallyAnnotateNodePath

packages/core/src/hydration/annotate.ts:758–791  ·  view source on GitHub ↗

* Serializes node location in cases when it's needed, specifically: * * 1. If `tNode.projectionNext` is different from `tNode.next` - it means that * the next `tNode` after projection is different from the one in the original * template. Since hydration relies on `tNode.next`, this seri

(
  ngh: SerializedView,
  tNode: TNode,
  lView: LView<unknown>,
  excludedParentNodes: Set<number> | null,
)

Source from the content-addressed store, hash-verified

756 * connection to identify the location of a node.
757 */
758function conditionallyAnnotateNodePath(
759 ngh: SerializedView,
760 tNode: TNode,
761 lView: LView<unknown>,
762 excludedParentNodes: Set<number> | null,
763) {
764 if (isProjectionTNode(tNode)) {
765 // Do not annotate projection nodes (<ng-content />), since
766 // they don't have a corresponding DOM node representing them.
767 return;
768 }
769
770 // Handle case #1 described above.
771 if (
772 tNode.projectionNext &&
773 tNode.projectionNext !== tNode.next &&
774 !isInSkipHydrationBlock(tNode.projectionNext)
775 ) {
776 appendSerializedNodePath(ngh, tNode.projectionNext, lView, excludedParentNodes);
777 }
778
779 // Handle case #2 described above.
780 // Note: we only do that for the first node (i.e. when `tNode.prev === null`),
781 // the rest of the nodes would rely on the current node location, so no extra
782 // annotation is needed.
783 if (
784 tNode.prev === null &&
785 tNode.parent !== null &&
786 isDisconnectedNode(tNode.parent, lView) &&
787 !isDisconnectedNode(tNode, lView)
788 ) {
789 appendSerializedNodePath(ngh, tNode, lView, excludedParentNodes);
790 }
791}
792
793/**
794 * Determines whether a component instance that is represented

Callers 1

serializeLViewFunction · 0.85

Calls 4

isProjectionTNodeFunction · 0.90
isInSkipHydrationBlockFunction · 0.90
isDisconnectedNodeFunction · 0.90
appendSerializedNodePathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…