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