* 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, )
| 521 | * in the tree. |
| 522 | */ |
| 523 | function cleanupParentContainer( |
| 524 | currentBlockIdx: number, |
| 525 | hydrationQueue: string[], |
| 526 | dehydratedBlockRegistry: DehydratedBlockRegistry, |
| 527 | ) { |
| 528 | // If a parent block exists, it's in the hydration queue in front of the current block. |
| 529 | const parentDeferBlockIdx = currentBlockIdx - 1; |
| 530 | const parentDeferBlock = |
| 531 | parentDeferBlockIdx > -1 |
| 532 | ? dehydratedBlockRegistry.get(hydrationQueue[parentDeferBlockIdx]) |
| 533 | : null; |
| 534 | if (parentDeferBlock) { |
| 535 | cleanupLContainer(parentDeferBlock.lContainer); |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | function cleanupRemainingHydrationQueue( |
| 540 | hydrationQueue: string[], |
no test coverage detected
searching dependent graphs…