Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isomorphic render issue on 1.0rc2 #1325

Closed
dhalbrook opened this issue Oct 25, 2016 · 7 comments
Closed

Isomorphic render issue on 1.0rc2 #1325

dhalbrook opened this issue Oct 25, 2016 · 7 comments

Comments

@dhalbrook
Copy link

I haven't looked into this deeply, but i'm seeing render warnings on client-side render in our isomorphic app. Looks like some state is being incremented on persistence? This is using 1.0rc2.

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) r" id="react-select-2--value" data-react
 (server) r" id="react-select-3--value" data-react
@dhalbrook
Copy link
Author

Seems it increments a global InstanceID on mount:

componentWillMount() {
        this._instancePrefix = 'react-select-' + (this.props.instanceId || ++instanceId) + '-';
        const valueArray = this.getValueArray(this.props.value);

        if (this.props.required) {
            this.setState({
                required: this.handleRequired(valueArray[0], this.props.multi),
            });
        }
    }

It appears I can solve this by setting the instanceID as a prop, but it would be nice if this were solved using default settings.

@dhalbrook
Copy link
Author

Looks like there is still an issue:

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) -reactid="7"><input role="combobox" aria
 (server) -reactid="7"><input aria-expanded="false

@dhalbrook
Copy link
Author

dhalbrook commented Oct 25, 2016

It appears like Object.assign is not acting consistently between node's runtime and Chrome. From Select.js#820

    ```
// TODO: Check how this project includes Object.assign()
        const inputProps = Object.assign({}, this.props.inputProps, {
            role: 'combobox',
            'aria-expanded': '' + isOpen,

@andreme
Copy link
Contributor

andreme commented Oct 26, 2016

instanceID is also a (undocumented) property. Set it to make sure it's the same on server and client.

@andreme
Copy link
Contributor

andreme commented Oct 26, 2016

Oh just saw you found that - weird, I'm running isomorphic as well and don't have a problem with node and Chrome.

@dhalbrook
Copy link
Author

Looks like i'm running into this now: facebook/react#6451

@EgorKluch
Copy link

Hi! I get same error in my isomorphic app.

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) r" id="react-select-2--value" data-react
(server) r" id="react-select-5--value" data-react

Please, fix it, or add prop instanceID to Docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants