Skip to content

Checksum issue with encoded characters in Chrome #4608

@mridgway

Description

@mridgway

We've recently started seeing issues with checksums on server rendered markup. Even though both the client and server are encoding the characters correctly, ReactMount is triggering a checksum warning and replacing the DOM. It seems Chrome may have changed its behavior with innerHTML/outerHTML and returns the encoded character rather than the encoding and causes the comparison to be incorrect. I do not see the issue in Firefox.

React.renderToString(<div>What's up</div>); correctly renders to <div>What&#x27;s up</div>, but React.render(<div>What's up</div>); over the same DOM shows warning:

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) -4.0.3.0.0">What&#x27;s up</div>
 (server) -4.0.3.0.0">What's up</div>

At first I thought the messages were mixed up, but actually outerHTML for the existing root node is returning the decoded string.

Perhaps this is a bug in Chrome?

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