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

Function trySerializeI18nBlock

packages/core/src/hydration/i18n.ts:179–211  ·  view source on GitHub ↗
(
  lView: LView,
  index: number,
  context: HydrationContext,
)

Source from the content-addressed store, hash-verified

177 * @returns the i18n data, or null if there is no relevant data
178 */
179export function trySerializeI18nBlock(
180 lView: LView,
181 index: number,
182 context: HydrationContext,
183): SerializedI18nBlock | null {
184 if (!context.isI18nHydrationEnabled) {
185 return null;
186 }
187
188 const tView = lView[TVIEW];
189 const tI18n = tView.data[index] as TI18n | undefined;
190 if (!tI18n || !tI18n.ast) {
191 return null;
192 }
193
194 const parentTNode = tView.data[tI18n.parentTNodeIndex] as TNode;
195 if (parentTNode && isI18nInSkipHydrationBlock(parentTNode)) {
196 return null;
197 }
198
199 const serializedI18nBlock: SerializedI18nBlock = {
200 caseQueue: [],
201 disconnectedNodes: new Set(),
202 disjointNodes: new Set(),
203 };
204 serializeI18nBlock(lView, serializedI18nBlock, context, tI18n.ast);
205
206 return serializedI18nBlock.caseQueue.length === 0 &&
207 serializedI18nBlock.disconnectedNodes.size === 0 &&
208 serializedI18nBlock.disjointNodes.size === 0
209 ? null
210 : serializedI18nBlock;
211}
212
213function serializeI18nBlock(
214 lView: LView,

Callers 1

serializeLViewFunction · 0.90

Calls 2

serializeI18nBlockFunction · 0.85

Tested by

no test coverage detected