fix: stream solid suspense chunks independently#7512
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit a37a984
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
Merging this PR will improve performance by 7.73%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | ssr request loop (solid) |
174.6 ms | 169 ms | +3.36% |
| ⚡ | client-side navigation loop (solid) |
72.6 ms | 64.7 ms | +12.3% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/solid-stream-boundary-flush (a37a984) with solid-router-v2-pre (67a9040)1
Not sure if this should go on main or just the
solid-router-v2-prebranch.Solid Streaming Fix
Why This Is Needed
Solid SSR can stream resolved
Loading/Suspense boundaries after the main HTML document has already emitted</body></html>.TanStack Router's SSR stream transform needs to inject router serialization scripts before the closing document tags. Before the fix, the transform treated everything from
</body>onward as the closing HTML tail and buffered it until the whole app render and router serialization finished.That accidentally buffered Solid's later boundary chunks too. In practice, a fast boundary like
deferredPersonresolving at 1s was held until a slower boundary likedeferredStuffresolved at 2s, so both appeared together instead of streaming independently.What The Fix Does
The transform now captures only the actual closing tags (
</body></html>) so router scripts can still be injected before them.Any renderer chunks that arrive after those closing tags, including Solid boundary templates and scripts, are streamed immediately instead of being appended to the closing-tag buffer.
This preserves the required router script ordering while allowing Solid boundaries to reveal as each promise resolves.