(root: ParentNode)
| 14 | |
| 15 | /** Flatten reveal wrappers when streaming finishes. */ |
| 16 | export function settleStreamChunks(root: ParentNode): void { |
| 17 | root.querySelectorAll(`.${STREAM_CHUNK_CLASS}`).forEach((span) => { |
| 18 | const parent = span.parentNode; |
| 19 | if (!parent) { |
| 20 | return; |
| 21 | } |
| 22 | while (span.firstChild) { |
| 23 | parent.insertBefore(span.firstChild, span); |
| 24 | } |
| 25 | span.remove(); |
| 26 | }); |
| 27 | } |