Skip to content

Props className did not match #15

Closed
@thmsmlr

Description

@thmsmlr

Hey hey, love the project. I'm using it on my blog. I've been trying to debug something with it though. I'm using Next.js with this project. Doing some of the static page generation that came out with next.js 9.4. I've notice something weird though.

When I render a page statically and render it, everything seems fine. However, when the javascript loads on the page right after load and rehydrates the page, it will try to rerender the syntax highlight of the code blocks and throw an error that the server rendered className is not equal to the client side className. This leads the renderer to remove all of the wrapping <span> which denote the various tokens in the code block.

When you load the page with Javascript disabled, everything looks great, but the minute you enable javascript in the browser, the syntax highlight flashes and it goes to a non-highlighted state.

This is the error i'm seeing. I've dug into it a little bit, and don't have any leads on how to debug. Have you seen this? Do you have any leads on how to fix?

react-dom.development.js:530 Warning: Prop `className` did not match. Server: " language-bash" Client: "language-bash"

With JS enabled:

image

With JS disabled:

image

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