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

Function locateDehydratedViewsInContainer

packages/core/src/hydration/views.ts:30–58  ·  view source on GitHub ↗
(
  currentRNode: RNode,
  serializedViews: SerializedContainerView[],
)

Source from the content-addressed store, hash-verified

28 * dehydrated views.
29 */
30export function locateDehydratedViewsInContainer(
31 currentRNode: RNode,
32 serializedViews: SerializedContainerView[],
33): [RNode, DehydratedContainerView[]] {
34 const dehydratedViews: DehydratedContainerView[] = [];
35 for (const serializedView of serializedViews) {
36 // Repeats a view multiple times as needed, based on the serialized information
37 // (for example, for *ngFor-produced views).
38 for (let i = 0; i < (serializedView[MULTIPLIER] ?? 1); i++) {
39 const view: DehydratedContainerView = {
40 data: serializedView,
41 firstChild: null,
42 };
43 if (serializedView[NUM_ROOT_NODES] > 0) {
44 // Keep reference to the first node in this view,
45 // so it can be accessed while invoking template instructions.
46 view.firstChild = currentRNode as HTMLElement;
47
48 // Move over to the next node after this view, which can
49 // either be a first node of the next view or an anchor comment
50 // node after the last view in a container.
51 currentRNode = siblingAfter(serializedView[NUM_ROOT_NODES], currentRNode)!;
52 }
53 dehydratedViews.push(view);
54 }
55 }
56
57 return [currentRNode, dehydratedViews];
58}
59
60/**
61 * Reference to a function that searches for a matching dehydrated views

Calls 2

siblingAfterFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…