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

Function getParentBlockHydrationQueue

packages/core/src/hydration/utils.ts:600–631  ·  view source on GitHub ↗
(
  deferBlockId: string,
  injector: Injector,
)

Source from the content-addressed store, hash-verified

598 * Note: This is utilizing serialized information to navigate up the tree
599 */
600export function getParentBlockHydrationQueue(
601 deferBlockId: string,
602 injector: Injector,
603): {parentBlockPromise: Promise<void> | null; hydrationQueue: string[]} {
604 const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
605 const transferState = injector.get(TransferState);
606 const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
607
608 let isTopMostDeferBlock = false;
609 let currentBlockId: string | undefined = deferBlockId;
610 let parentBlockPromise: Promise<void> | null = null;
611 const hydrationQueue: string[] = [];
612
613 while (!isTopMostDeferBlock && currentBlockId) {
614 ngDevMode &&
615 assertEqual(
616 hydrationQueue.indexOf(currentBlockId),
617 -1,
618 'Internal error: defer block hierarchy has a cycle.',
619 );
620
621 isTopMostDeferBlock = dehydratedBlockRegistry.has(currentBlockId);
622 const hydratingParentBlock = dehydratedBlockRegistry.hydrating.get(currentBlockId);
623 if (parentBlockPromise === null && hydratingParentBlock != null) {
624 parentBlockPromise = hydratingParentBlock.promise;
625 break;
626 }
627 hydrationQueue.unshift(currentBlockId);
628 currentBlockId = deferBlockParents[currentBlockId][DEFER_PARENT_BLOCK_ID];
629 }
630 return {parentBlockPromise, hydrationQueue};
631}
632
633function gatherDeferBlocksByJSActionAttribute(doc: Document): Set<HTMLElement> {
634 const jsactionNodes = doc.body.querySelectorAll('[jsaction]');

Callers 1

Calls 4

assertEqualFunction · 0.90
indexOfMethod · 0.80
getMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…