mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #792] Audit Pages Router SSR for styled-jsx race condition (concurrent rendering drops dynamic styles) #174
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#174
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (Apr 8, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/792
Upstream change
Next.js fixed a race condition in Pages Router SSR where dynamic styled-jsx styles were silently dropped from rendered HTML.
Commit:
9853944— "Fix styled-jsx race condition: styles lost due to concurrent rendering (#92459)"What changed
In
packages/next/src/server/render.tsx,styledJsxInsertedHTML()was previously called concurrently with the page render viaPromise.all:Because both ran at the same time,
styledJsxInsertedHTML()could flush the styled-jsx registry before the page render had finished populating it. Dynamic styled-jsx styles (those with interpolated expressions that compute class names at runtime via DJB2 hashing) were silently dropped from SSR output, causing a flash of unstyled content.Fix: Serialize the operations — render the page first, then call
styledJsxInsertedHTML().Relevance to vinext
vinext reimplements Pages Router SSR in
server/dev-server.tsandserver/prod-server.ts. If vinext's SSR render path for Pages Router apps also reads the styled-jsx registry concurrently with (or before) page rendering completes, the same race condition could cause dynamic styled-jsx styles to be missing from SSR output.Action items:
styledJsxInsertedHTML()or reads the styled-jsx registry