MCPcopy Create free account
hub / github.com/angular/angular / ɵɵdefer

Function ɵɵdefer

packages/core/src/defer/instructions.ts:125–225  ·  view source on GitHub ↗
(
  index: number,
  primaryTmplIndex: number,
  dependencyResolverFn?: DependencyResolverFn | null,
  loadingTmplIndex?: number | null,
  placeholderTmplIndex?: number | null,
  errorTmplIndex?: number | null,
  loadingConfigIndex?: number | null,
  placeholderConfigIndex?: number | null,
  enableTimerScheduling?: typeof ɵɵdeferEnableTimerScheduling | null,
  flags?: TDeferDetailsFlags | null,
)

Source from the content-addressed store, hash-verified

123 * @codeGenApi
124 */
125export function ɵɵdefer(
126 index: number,
127 primaryTmplIndex: number,
128 dependencyResolverFn?: DependencyResolverFn | null,
129 loadingTmplIndex?: number | null,
130 placeholderTmplIndex?: number | null,
131 errorTmplIndex?: number | null,
132 loadingConfigIndex?: number | null,
133 placeholderConfigIndex?: number | null,
134 enableTimerScheduling?: typeof ɵɵdeferEnableTimerScheduling | null,
135 flags?: TDeferDetailsFlags | null,
136) {
137 const lView = getLView();
138 const tView = getTView();
139 const adjustedIndex = index + HEADER_OFFSET;
140 const tNode = declareNoDirectiveHostTemplate(lView, tView, index, null, 0, 0);
141 const injector = lView[INJECTOR];
142
143 const incrementalHydrationEnabled = isIncrementalHydrationEnabled(injector);
144 if (tView.firstCreatePass) {
145 performanceMarkFeature('NgDefer');
146
147 if (ngDevMode) {
148 if (typeof ngHmrMode !== 'undefined' && ngHmrMode) {
149 logHmrWarning(injector);
150 }
151 if (hasHydrateTriggers(flags) && !incrementalHydrationEnabled) {
152 warnIncrementalHydrationNotConfigured();
153 }
154 }
155
156 const tDetails: TDeferBlockDetails = {
157 primaryTmplIndex,
158 loadingTmplIndex: loadingTmplIndex ?? null,
159 placeholderTmplIndex: placeholderTmplIndex ?? null,
160 errorTmplIndex: errorTmplIndex ?? null,
161 placeholderBlockConfig: null,
162 loadingBlockConfig: null,
163 dependencyResolverFn: dependencyResolverFn ?? null,
164 loadingState: DeferDependenciesLoadingState.NOT_STARTED,
165 loadingPromise: null,
166 providers: null,
167 hydrateTriggers: null,
168 debug: null,
169 flags: flags ?? TDeferDetailsFlags.Default,
170 };
171 enableTimerScheduling?.(tView, tDetails, placeholderConfigIndex, loadingConfigIndex);
172 setTDeferBlockDetails(tView, adjustedIndex, tDetails);
173 }
174
175 const lContainer = lView[adjustedIndex];
176
177 // If hydration is enabled, looks up dehydrated views in the DOM
178 // using hydration annotation info and stores those views on LContainer.
179 // In client-only mode, this function is a noop.
180 populateDehydratedViewsInLContainer(lContainer, tNode, lView);
181
182 let ssrBlockState = null;

Callers

nothing calls this directly

Calls 15

getLViewFunction · 0.90
getTViewFunction · 0.90
performanceMarkFeatureFunction · 0.90
hasHydrateTriggersFunction · 0.90
setTDeferBlockDetailsFunction · 0.90
setLDeferBlockDetailsFunction · 0.90
storeTriggerCleanupFnFunction · 0.90
removeLViewOnDestroyFunction · 0.90

Tested by

no test coverage detected