distilagency / starward

:boom: ReactJS Wordpress Boilerplate
27 stars 9 forks source link

Code splitting SSR warning #129

Open falconmick opened 6 years ago

falconmick commented 6 years ago

@markmollart and I have found that we are getting the following warning from the server during development:

Warning: setState(...): Can only update a mounting component. This usually means you called setState() outside componentWillMount() on the server. This is a no-op.

This is being caused (to the best of my guesses and looking over source) by the componentWillMount call to setState inside of app/routes.jsx as we are calling setState inside of a callback.

I did some quick googling and apparently the solution is to via the webpack config file disable code splitting..Theoretically this query in the above file would no longer block and therefore would return within the componentWillMount call, thus causing the error to go away. google solution

Technically it's just a warning so we can ignore it, but I don't like warnings.

If either @AllanPooley @samlogan or myself can handle this, please assign yourself.