Repository navigation
fix: render a no-JS form post's outcome inline (#724) - #730
Merged
Merged
Conversation
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 detectedLatest commit: 4bfc136 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
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
Rootnow readsrouterState.submissionson 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 inRootso the retry starts clean. A request without a flash cookie seeds[]and never suspends.isServer &&), so it folds out of client bundles. Client bundle measured with thesolidcondition,isServer=false, terser and brotli: 41,497 B min / 14,205 B br before and after, 0 B._hkvalues in the shell matchnext.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
App.tsx). Without JavaScript: POST → 303 + flash → GET. Onnext, 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.test/server/flash-no-js-inline.spec.tsxpipes 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 onnextand passes here.pnpm buildok. Client 756/756, server 108/108, types pass.Generated by Claude Code