Repository navigation
Prerender the dashboard into index.html - #17
Merged
Merged
Conversation
build.ts renders the placeholder layout with react-dom/server and the page hydrates it, so the dashboard is there before the 675 KB script runs. The placeholder is laid out as of the build time, which index.html carries as data-now, and useStored hydrates from its fallback before reading storage, so hydration matches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
index.htmlshipped an empty<div id="app">, so the page stayed blank until the 675 KB script had loaded and run, and only then laid out the placeholder dashboard from #16. Now the build prerenders that placeholder intoindex.htmland the script hydrates it, so the layout is there on first paint.How
web/build.ts,web/src/prerender.tsx): after the page bundle,build.tsbundlesprerender.tsxfor Bun, callsrenderToString(<App />), and writes the result intodist/index.html's#app. Bundling, not importing, gives the icons the same hashed names as the page's bundle.nowthat#appcarries asdata-now, the build time.frontend.tsxhydrates with that value, and falls back tocreateRootwhen it's missing, as underdev.ts. Everything that time decides is veiled while pending.LastRunswitches to the visitor's clock right after hydration, so real data never reads as of the build.web/src/stored.ts):useStorednow usesuseSyncExternalStore. Its server snapshot is the fallback, so hydration renders arm64 / 256 MB, then switches to what the visitor stored. It still keeps picks in memory when storage refuses them.data-nosnippet, since its made-up numbers are now in the HTML.Verified
I served
dist/with a delayed/api/runs/history(production's history) in headless Chrome:arch/memory/compareWeb.<h1>is the same node after hydration.data-nowraises React's hydration error.Limits
index.htmlgrows from 4 KB to 337 KB (27 KB gzipped).Created with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code