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

Function appendI18nNodeToCollection

packages/core/src/hydration/i18n.ts:357–379  ·  view source on GitHub ↗

* Marks the current RNode as the hydration root for the given * AST node.

(
  context: I18nHydrationContext,
  state: I18nHydrationState,
  astNode: I18nNode,
)

Source from the content-addressed store, hash-verified

355 * AST node.
356 */
357function appendI18nNodeToCollection(
358 context: I18nHydrationContext,
359 state: I18nHydrationState,
360 astNode: I18nNode,
361) {
362 const noOffsetIndex = astNode.index - HEADER_OFFSET;
363 const {disconnectedNodes} = context;
364 const currentNode = state.currentNode;
365
366 if (state.isConnected) {
367 context.i18nNodes.set(noOffsetIndex, currentNode);
368
369 // We expect the node to be connected, so ensure that it
370 // is not in the set, regardless of whether we found it,
371 // so that the downstream error handling can provide the
372 // proper context.
373 disconnectedNodes.delete(noOffsetIndex);
374 } else {
375 disconnectedNodes.add(noOffsetIndex);
376 }
377
378 return currentNode;
379}
380
381/**
382 * Skip over some sibling nodes during hydration.

Callers 1

collectI18nNodesFromDomFunction · 0.85

Calls 3

setMethod · 0.65
addMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…