fix(store): /new painted the handoff card before redirecting - #26
Merged
Conversation
Moving the blank-deck create to the worker removed the two megabytes and the progress text, but not the screen. The decision lived at the BOTTOM of the body, so a person reaching /new directly still got the whole card parsed and painted first — heading, Deck and Size rows, a Save button, a Close button and a footer telling them to keep the tab open — none of it addressed to them, on screen for as long as the redirect plus the create took. From the index it was invisible, because that button goes straight to /new/blank. From a bookmark or a typed URL it was the same screen as before, which is exactly what it looked like: not fixed. The redirect moves to a parser-blocking inline script at the top of the body, before any of that markup exists — the same trick kernel/src/save.ts uses to delete the preview before a browser can paint it. It is emitted only when the create branch is on, so what the page is willing to do stays readable in the bytes, which is how the retired host's behaviour is checked. I verified the earlier fix by screenshotting after the redirect had completed, which could only ever show the destination. The rig now pins the ORDERING: the redirect must appear before <main>, before the Save button and before the footer. 377/377. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhNJ6no7FeLu15siczqD3C
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.
#25 moved the blank-deck create to the worker. It removed the two megabytes and the progress text, but not the screen — Johan was still seeing it.
What I got wrong
The decision lived at the bottom of the body. So a person reaching
/newdirectly got the whole card parsed and painted first — heading, Deck and Size rows, a Save button, a Close button, and a footer telling them to keep the tab open — none of it addressed to them, on screen for as long as the redirect plus the create took.From the index it was invisible, because that button goes straight to
/new/blank. From a bookmark or a typed URL it was the same screen as before.I verified #25 by screenshotting after the redirect had completed, which could only ever show the destination. That is the actual mistake here, not the placement.
The fix
The redirect moves to a parser-blocking inline script at the top of the body, before any of that markup exists — the same trick
kernel/src/save.tsuses to delete the first-page preview before a browser can paint it.It is emitted only when the create branch is on, so what the page is willing to do stays readable in the bytes. That is how the retired host's behaviour is checked, and it keeps dead code out of the handoff page.
Verification
Rig 377/377, and it now pins the ordering rather than the presence:
<main>id="save", the button belonging to the other audienceif (window.opener) returnstill comes first, so the handoff winsUnchanged: the handoff card itself, the old host's exemptions,
NEW_ENABLED.Worker only —
wrangler deploy, no shell release.🤖 Generated with Claude Code
https://claude.ai/code/session_01KhNJ6no7FeLu15siczqD3C