MCPcopy
hub / github.com/angular/angular / removeDehydratedViews

Function removeDehydratedViews

packages/core/src/hydration/cleanup.ts:33–54  ·  view source on GitHub ↗
(lContainer: LContainer)

Source from the content-addressed store, hash-verified

31 * corresponding DOM nodes that belong to that dehydrated view.
32 */
33export function removeDehydratedViews(lContainer: LContainer) {
34 const views = lContainer[DEHYDRATED_VIEWS] ?? [];
35 const parentLView = lContainer[PARENT];
36 const renderer = parentLView[RENDERER];
37 const retainedViews = [];
38 for (const view of views) {
39 // Do not clean up contents of `@defer` blocks.
40 // The cleanup for this content would happen once a given block
41 // is triggered and hydrated.
42 if (view.data[DEFER_BLOCK_ID] !== undefined) {
43 retainedViews.push(view);
44 } else {
45 removeDehydratedView(view, renderer);
46 ngDevMode && ngDevMode.dehydratedViewsRemoved++;
47 }
48 }
49 // Reset the value to an array to indicate that no
50 // further processing of dehydrated views is needed for
51 // this view container (i.e. do not trigger the lookup process
52 // once again in case a `ViewContainerRef` is created later).
53 lContainer[DEHYDRATED_VIEWS] = retainedViews;
54}
55
56export function removeDehydratedViewList(deferBlock: DehydratedDeferBlock) {
57 const {lContainer} = deferBlock;

Callers 4

ɵɵrepeaterFunction · 0.90
cleanupLContainerFunction · 0.85

Calls 2

removeDehydratedViewFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…