( lView: LView, index: number, context: HydrationContext, )
| 177 | * @returns the i18n data, or null if there is no relevant data |
| 178 | */ |
| 179 | export 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 | |
| 213 | function serializeI18nBlock( |
| 214 | lView: LView, |
no test coverage detected