Skip to content

fix: render a no-JS form post's outcome inline (#724) - #730

Merged
ryansolid merged 1 commit into
nextfrom
claude/router-nojs-flash-inline
Nov 17, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/router-nojs-flash-inline

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Fixes #724.

Problem

After a no-JS form post, the server redirects back with a flash cookie. On that GET the router decodes the cookie (WebCrypto, async) the first time submissions are read. In the usual app shape, that read sits under the app's <Loading>. The decode suspended that boundary, the shell flushed its fallback, and the form plus its error streamed later as a <template> with a $df() swap. A browser without JavaScript never runs the swap, so the page showed only "loading".

Fix

Root now reads routerState.submissions on the server before it creates anything or renders the app root. That puts the suspension in the router's root slot, above any boundary the app renders, and a root slot holds the shell until it resolves. The outcome then renders inline. It runs first in Root so the retry starts clean. A request without a flash cookie seeds [] and never suspends.

  • Server-only (isServer &&), so it folds out of client bundles. Client bundle measured with the solid condition, isServer=false, terser and brotli: 41,497 B min / 14,205 B br before and after, 0 B.
  • Hydration ids are unchanged: there is no new JSX slot, and the _hk values in the shell match next.
  • A request with a flash cookie now always decodes it, even when nothing reads submissions. Flash cookies only come from no-JS posts.

I first tried a new {isServer && …} slot in the router JSX. It fixed the bug but added about 34 B br on the client, because the slot is still inserted there. I dropped it for this version.

Verification

  • Reproduced in a real start-mode app (vite-plugin next.57, solid 2.0.0, the issue's App.tsx). Without JavaScript: POST → 303 + flash → GET. On next, the GET shows the fallback, two <template>s and no inline form. With this branch, the form and "Too short" render inline, with no fallback and no template.
  • New test/server/flash-no-js-inline.spec.tsx pipes the stream and checks the first chunk. (renderToStream().then(String) waits for the whole stream and inlines every boundary, which hid this bug from the existing flash specs.) It fails on next and passes here.
  • pnpm build ok. Client 756/756, server 108/108, types pass.

Generated by Claude Code

The flash decode suspended under the app's <Loading>, so the shell flushed
the fallback and the outcome only streamed as a <template> that a browser
without JavaScript never swaps in. Root now reads submissions on the
server before the app's root renders, so the decode holds the shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWKegJTJmg5nmox4u4v
@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4bfc136

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ryansolid ryansolid self-assigned this Nov 17, 2026
@ryansolid
ryansolid merged commit 00c6f31 into next Nov 17, 2026
4 checks passed
@ryansolid
ryansolid deleted the claude/router-nojs-flash-inline branch November 17, 2026 07:51
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.

2 participants