Skip to content

Hydration breaks the HTML (class) #11336

Closed
@SamyPesse

Description

@SamyPesse

We've updated an application to React 16, this app is using react-responsive.

Since we've updated to React 16, we have bugs related to invalid HTML being outputted by React hydration.

Our server generates an HTML for the desktop, but if the client has a mobile, the rendering mismatch. Previously it was causing a full re-render by ReactDOM.render, it was not perfect, but it worked.

With React 16, ReactDOM.hydrate is supposed to not-rerender everything but only the mismatching parts. But after we run ReactDOM.hydrate, the HTML is an invalid mix of both (class are sliced).

1) HTML generated by the server (desktop mode)

This is the HTML being served by the server (before hydration):

screen shot 2017-10-23 at 11 35 11

2) HTML generated by the client without SSR (normal mobile mode)

This is the HTML being rendered by React, when we disable SSR:

screen shot 2017-10-23 at 11 39 07

3) Wrong HTML generated by hydration of 1) in client (mobile mode)

This is the invalid HTML being rendered by React when it tries to hydrate 1) with 2). The expected HTML is 2).

screen shot 2017-10-23 at 11 36 46

Versions

Chrome 61.0.3163.100
React v16.0.0

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