Skip to content

inline <style> tags get removed by <Suspense> streaming, making styles disappear #5808

Done

Description

@laurenskling

In my Nextjs project with cacheComponents, I have a reading the searchParams to see if it needs to set pre-selected search options in my search engine. The fallback I give it, is the search options components without any selections, and when searchParams are read, the correct selections are set. So I move from a "skeleton" (the fully rendered engine, without selection) to the "real" populated component.

Since the component is rendered in fallback at first, it receives <style> tags for components that are unique to that component. When the final populated comes in, the component is replaced by Next. Since SC is no longer doing its magic at this point, the <style> tag is not included here. It gets removed. Thus my styling disappears.

Schermopname.2026-09-03.om.14.27.01.mov

Also #5728 is still a bug with the inline <style> tags. Although its hard to reproduce the setup where streaming is that obvious.

The move to inline <style> tags is blocking me from upgrading to 6.4.2+ (for https://github.com/styled-components/styled-components/issues/57270). I'm not a big fan of the inline choice. Which is a shame because I love the work you've been putting into the project recently. Thank you.

Activity

  1. pullfrog commented on Sep 3, 2026

    @pullfrog
  2. laurenskling commented on Sep 6, 2026

    @laurenskling
    Author

    Sadly still happens

  3. quantizor commented on Sep 8, 2026

    @quantizor
    Contributor

    Thanks again for the clear report and video @laurenskling. This should be fixed on the latest 6.x prerelease:

    (or [email protected]). When you get a chance, could you retest and confirm the styles hold through the Suspense reveal? https://www.npmjs.com/package/styled-components/v/6.6.0-prerelease-20260908162735

  4. laurenskling commented on Sep 17, 2026

    @laurenskling
    Author

    It works! Thank you

  5. laurenskling commented on Sep 18, 2026

    @laurenskling
    Author

    I guess this is related; looping over a SC makes the style be rendered for ever cycle:

    Image
  6. quantizor commented on Oct 12, 2026

    @quantizor
    Contributor

    Made some additional improvements, but some amount of duplication cannot be helped in this scenario. Final implementation now out in 6.6, thanks! https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0

  7. quantizor commented on Nov 25, 2026

    @quantizor
    Contributor

    Fixed in 6.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions