Skip to content

App Router: useServerInsertedHTML CSS-in-JS initial styles not emitted in SSR #1826

@james-elicx

Description

@james-elicx

This issue was created by an agent auditing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-06-08).

Problem

useServerInsertedHTML (the hook CSS-in-JS libraries such as styled-components / emotion use to flush collected styles into the SSR stream) does not emit initial styles. The whole suite fails (0 passing) for both runtimes and for the suspense path.

Affected Test Suites

  • test/e2e/app-dir/use-server-inserted-html/use-server-inserted-html.test.ts (3 failures)
    • should render initial styles of css-in-js in nodejs SSR correctly
    • should render initial styles of css-in-js in edge SSR correctly
    • should render css-in-js suspense boundary correctly

Estimated impact

~3 e2e failures.

Notes

Distinct from the CSS-module build issues (#1509 / #1515 / #1346) — this is the server-inserted-HTML streaming hook, not bundler CSS handling.

Recommendation

  1. Reproduce with a minimal useServerInsertedHTML(() => <style>…</style>) provider and assert the style is present in the SSR HTML (and re-inserted across suspense flushes).
  2. Ensure the RSC/SSR renderer invokes the registered server-inserted-HTML callbacks at each flush boundary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions