* Marks the current RNode as the hydration root for the given * AST node.
( context: I18nHydrationContext, state: I18nHydrationState, astNode: I18nNode, )
| 355 | * AST node. |
| 356 | */ |
| 357 | function appendI18nNodeToCollection( |
| 358 | context: I18nHydrationContext, |
| 359 | state: I18nHydrationState, |
| 360 | astNode: I18nNode, |
| 361 | ) { |
| 362 | const noOffsetIndex = astNode.index - HEADER_OFFSET; |
| 363 | const {disconnectedNodes} = context; |
| 364 | const currentNode = state.currentNode; |
| 365 | |
| 366 | if (state.isConnected) { |
| 367 | context.i18nNodes.set(noOffsetIndex, currentNode); |
| 368 | |
| 369 | // We expect the node to be connected, so ensure that it |
| 370 | // is not in the set, regardless of whether we found it, |
| 371 | // so that the downstream error handling can provide the |
| 372 | // proper context. |
| 373 | disconnectedNodes.delete(noOffsetIndex); |
| 374 | } else { |
| 375 | disconnectedNodes.add(noOffsetIndex); |
| 376 | } |
| 377 | |
| 378 | return currentNode; |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Skip over some sibling nodes during hydration. |
no test coverage detected
searching dependent graphs…