Skip to content

createGlobalStyle adds stylings to the <head> twice in 5.0.1 #3076

@natterstefan

Description

@natterstefan

Environment

  • react@16.12.0
  • react-dom@16.12.0
  • react-scripts@3.0.1
  • styled-components@5.0.1

⬇️ see codesandbox example.

Reproduction

Steps to reproduce

Open the provided codesandbox and inspect the styling of either of the headlines. The h1 (or h2) styling is applied twice because it was added twice to the document.

If you downgrade styled-components (see codesandbox) to the latest 4.x.x version and inspect the elements again, everything is fine.

Expected Behavior

Global style is added only once.

Actual Behavior

Global style is added twice to the document (also in a SSR scenario, which happens in one of our apps right now).

Screenshots

Bug with version 5.0.1

image

Working w/ version 4.4.1

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions