MCPcopy Create free account
hub / github.com/angular/angular / cleanupParentContainer

Function cleanupParentContainer

packages/core/src/defer/triggering.ts:542–556  ·  view source on GitHub ↗

* Clean up the parent container of a block where content changed between server and client. * The parent of a block going through `triggerHydrationFromBlockName` will contain the * dehydrated content that needs to be cleaned up. So we have to do the clean up from that location * in the tree.

(
  currentBlockIdx: number,
  hydrationQueue: string[],
  dehydratedBlockRegistry: DehydratedBlockRegistry,
)

Source from the content-addressed store, hash-verified

540 * in the tree.
541 */
542function cleanupParentContainer(
543 currentBlockIdx: number,
544 hydrationQueue: string[],
545 dehydratedBlockRegistry: DehydratedBlockRegistry,
546) {
547 // If a parent block exists, it's in the hydration queue in front of the current block.
548 const parentDeferBlockIdx = currentBlockIdx - 1;
549 const parentDeferBlock =
550 parentDeferBlockIdx > -1
551 ? dehydratedBlockRegistry.get(hydrationQueue[parentDeferBlockIdx])
552 : null;
553 if (parentDeferBlock) {
554 cleanupLContainer(parentDeferBlock.lContainer);
555 }
556}
557
558function cleanupRemainingHydrationQueue(
559 hydrationQueue: string[],

Callers 1

Calls 2

cleanupLContainerFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected