erikras / erikras/react-redux-universal-hot-example

Disabling server-side rendering produces warnings

Open
#492 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hej Erik,

I have been using your example as a boilerplate. I've earlier on encountered a problem, which I back then assumed was a conflict in my own code. But it seems, that the error is within this example.

I have cloned the repo again today to try and replicate the error. I've replicated:
commit: 52d41860e299cd6a97221e162149ee1e0231004a,
headline: 'loosened deps to appease the evil greenkeeper'

The only change I've made to the example is in:
bin -> server.js
In this file, I've changed the variable global.**DISABLE_SSR** from false to true.

As I understand, this should disable the server side rendering.

However, this causes warnings in the console:

```
Warning: Failed propType: Required prop `location` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
warning.js:45 Warning: Failed propType: Invalid prop `routes` of type `object` supplied to `RoutingContext`, expected `array`. Check the render method of `ReduxRouterContext`.
warning.js:45 Warning: Failed propType: Required prop `params` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
warning.js:45 Warning: Failed propType: Required prop `components` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
warning.js:45 Warning: Failed Context Types: Required child context `location` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
client.js:52 Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.
warning.js:45 Warning: Failed Context Types: Required child context `location` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
```

I haven't changed anything else besides the variable.

I've tried to understand the warnings. And looking at the redux-dev-tools, it seems, there's a timing issue:

The first few times the store is being dispatched, the router-property on the store is null. And it seems to me, that this is what causes the warnings.

I'm not quite sure, how to solve this issue, so I'm hoping for your help :-). Any advice or comments would be much appreciated.

Regards

Martin

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.