* Clean up the parent container of a block where content changed between server and client. * The parent of a block going through `triggerHydrationFromBlockName` will contain the * dehydrated content that needs to be cleaned up. So we have to do the clean up from that location * in the tree.
( currentBlockIdx: number, hydrationQueue: string[], dehydratedBlockRegistry: DehydratedBlockRegistry, )
| 540 | * in the tree. |
| 541 | */ |
| 542 | function cleanupParentContainer( |
| 543 | currentBlockIdx: number, |
| 544 | hydrationQueue: string[], |
| 545 | dehydratedBlockRegistry: DehydratedBlockRegistry, |
| 546 | ) { |
| 547 | // If a parent block exists, it's in the hydration queue in front of the current block. |
| 548 | const parentDeferBlockIdx = currentBlockIdx - 1; |
| 549 | const parentDeferBlock = |
| 550 | parentDeferBlockIdx > -1 |
| 551 | ? dehydratedBlockRegistry.get(hydrationQueue[parentDeferBlockIdx]) |
| 552 | : null; |
| 553 | if (parentDeferBlock) { |
| 554 | cleanupLContainer(parentDeferBlock.lContainer); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | function cleanupRemainingHydrationQueue( |
| 559 | hydrationQueue: string[], |
no test coverage detected