Skip to content

docs(react): document the Next.js App Router SSR setup#995

Open
vashek wants to merge 1 commit into
microsoft:mainfrom
vashek:docs/nextjs-app-router-ssr
Open

docs(react): document the Next.js App Router SSR setup#995
vashek wants to merge 1 commit into
microsoft:mainfrom
vashek:docs/nextjs-app-router-ssr

Conversation

@vashek

@vashek vashek commented Jun 20, 2026

Copy link
Copy Markdown

The SSR guide only covered the Pages Router (_document, one-shot). Add an App Router section using useServerInsertedHTML, and explain why the renderer must be cleared after each streaming flush: renderToStyleElements returns the renderer's entire accumulated CSS on every call, so without clearing, Next duplicates the full stylesheet into on later flushes. Those stale copies override head-inserted styles after a client-side navigation, making makeStyles overrides lose to their makeResetStyles base. Also clarifies the existing heading as 'Next.js (Pages Router)'.

The SSR guide only covered the Pages Router (_document, one-shot). Add an App Router section using useServerInsertedHTML, and explain why the renderer must be cleared after each streaming flush: renderToStyleElements returns the renderer's entire accumulated CSS on every call, so without clearing, Next duplicates the full stylesheet into <body> on later flushes. Those stale copies override head-inserted styles after a client-side navigation, making makeStyles overrides lose to their makeResetStyles base. Also clarifies the existing heading as 'Next.js (Pages Router)'.
@vashek vashek requested a review from a team as a code owner June 20, 2026 14:21
@vashek

vashek commented Jun 20, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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