You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1c0e309
Browse filesBrowse the repository at this point in the historyBrowse files
fix: emit RSC styles per instance so they survive Suspense reveals (#5808)
RSC style emission deduped inline <style> tags across a request via a React.cache-scoped Set. That ledger outlives a Suspense fallback's DOM: a component rendered in a fallback recorded its class, the resolved child then emitted nothing, and React discarded the fallback (CSS and all) on reveal, leaving the resolved element with a class but no rule.
Each server-rendered instance now emits exactly its own render's classes (leaf plus the :where()-wrapped base chain), read per name from the compiled cache so emission stays O(chain) even for a dynamic base. Referenced keyframes are scoped per render rather than flushing every keyframe in the request. Styles stay inline (no precedence hoisting) so cross-boundary extensions keep winning by source order (#5672) and stylisPluginRSC's child-index rewriting holds.
A development-only warning fires when one component emits a very large number of tags in a single render, pointing at the attrs + inline CSS-variable pattern.
createGlobalStyle carries the same request-scoped dedup and is intentionally left for a separate change, since its dedup is documented behavior.
Fixed styles disappearing from a server-rendered component when it is revealed from behind a React `<Suspense>` boundary, such as a streaming Next.js route (including `cacheComponents`). A component shown first in a Suspense fallback and then in the resolved content kept its class name but lost its CSS, because the rule had been emitted only inside the fallback that React discards on reveal.
6
+
7
+
Each server-rendered instance now carries its own inline `<style>`, so its styles always travel with it and survive the boundary. Identical rules compress away under gzip, so the extra output is negligible; only a very large repeated list (thousands of instances of one component on a single page) is worth collapsing into a shared class, and a development-only warning points that out if it happens.
0 commit comments