Skip to content

Server-side rendering links incorrect component #16796

@SimplyComplexable

Description

@SimplyComplexable

Bug report

Describe the bug

I have certain circumstances where a component is rendered differently on the server then the client due to certain data being available.
In next versions prior to v9.0.7 this didn't cause any issues, but in every version since Next gets confused about which component is being rendered and starts to mix up the styles

To Reproduce

See the reproduction repo here
As stated in the README

  • Test should render with a blue background
  • Test2 should render with a red background
  • If this is rendered on the server Test both with have a red background.
  • If this is rendered by Fast Refresh / HMR it will render correctly.

If you downgrade next to 9.0.6 it will render correctly regardless

Expected behavior

It should render correctly regardless.

Screenshots

image

System information

  • OS: macOS
  • Browser (if applies) chrome
  • Version of Next.js: >9.0.6
  • Version of Node.js: multiple version 12 and up

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.please verify canaryPlease verify the issue with the latest canary branch.

    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