Skip to content

fix(store): /new painted the handoff card before redirecting - #26

Merged
johanhal merged 1 commit into
mainfrom
fix/new-page-flash
Sep 10, 2026
Merged

fix(store): /new painted the handoff card before redirecting#26
johanhal merged 1 commit into
mainfrom
fix/new-page-flash

Conversation

@johanhal

Copy link
Copy Markdown

#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 /new directly 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.ts uses 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:

  • the redirect appears before <main>
  • before id="save", the button belonging to the other audience
  • before the "keep this tab open" footer
  • and if (window.opener) return still comes first, so the handoff wins

Unchanged: 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

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
@johanhal
johanhal merged commit 8b7a353 into main Sep 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant