gabrielbull / react-router-server

Server Side Rendering library for React Router v4.
MIT License
434 stars 17 forks source link

Example project with hot reloading #17

Closed tobiasandersen closed 7 years ago

tobiasandersen commented 7 years ago

Hi, great job with the project!

I'm trying to set up hot reloading with your example project, but without any luck so far. Have you tried getting it running?

gabrielbull commented 7 years ago

Haven't tried with hot reloading yet, but I do want to have an example project that works with it.

benceg commented 7 years ago

Hi @tobiasandersen and @gabrielbull,

Did either of you get this working?

From what I can tell, there's an issue here with HMR preserving components' state within the component tree. Given that module is a key within Module's state, HMR is reloading the relevant code chunks but is not updating or flushing each Module component's state. This means the UI does not update to reflect the reloaded module(s).

Some cursory Googling indicates that this is a fairly common problem, with no catch-all solution yet available.

smarchetti commented 7 years ago

In the meantime, I've published my fork of this with the above PR. You can access it here:

https://www.npmjs.com/package/react-router-server-hmr