bdefore / universal-redux

An npm package that lets you jump right into coding React and Redux with universal (isomorphic) rendering. Only manage Express setups or Webpack configurations if you want to.
MIT License
460 stars 48 forks source link

@@router/UPDATE_LOCATION fired after first dispatched action #91

Closed jazzido closed 3 years ago

jazzido commented 8 years ago

I've noticed that @@router/UPDATE_LOCATION (from react-redux-router) is being fired after the first action that is dispatched, immedialy after the initial page load:

update-location-bug

In my project, this is causing redux-async-connect to refetch the data that is already stored in the state.

This branch of universal-redux-starter reproduces the reported issue.

bdefore commented 8 years ago

Possibly relevant: https://github.com/erikras/react-redux-universal-hot-example/pull/961

jazzido commented 8 years ago

The issue is also present when __DEVTOOLS__ == false. Happens in production mode too: although the action logging is disabled, I notice the full page redraw.

Maybe it has to do with the synchronization of history that happens in shared/create.js ?

jazzido commented 8 years ago

I've partially addressed this in jazzido/universal-redux@ccba65b717634ef02c4db0df3682159ef8e7cc31. The most relevant changes are:

However, it seems that if DevComponent enabled, the full reload happens anyway. Since I don't use it in my project, I'm not affected by that issue. In any case, feel free to merge from my fork.

Thanks!