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

Function removeDehydratedViews

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

Source from the content-addressed store, hash-verified

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