acdlite / redux-router

Redux bindings for React Router – keep your router state inside your Redux store
MIT License
2.3k stars 200 forks source link

Why is history.replaceState called? #177

Closed patrick91 closed 8 years ago

patrick91 commented 8 years ago

Hi everyone, first of all here's a bit of context:

I'm implementing redux router in a website which is using ReactCSSTransitionGroup to fade some elements on the page when the route is changed.

As soon as I added RR I started getting this error:

Uncaught TypeError: Cannot read property 'componentDidLeave' of undefined

after a while I realised that the ReactCSSTransitionGroupChild transition method was called three times (but it should be only called twice, once per element). Trying to debug this issue I found out that for some reason both pushState and replaceState get called when using a Link element, here's an example:

I would like to understand why replaceState is called, so that I can understand if there's a way to fix the issue I'm having.

The code I'm talking about is here

Mafioso commented 8 years ago

+1

Mafioso commented 8 years ago

I have the following issue: When I am clicking on some <Link /> object from previous component (url) to the next, suddenly previous component called again, but with new getState().get('router') state in mapStateToProps function param of the react-redux::connect API function. What I noticed while debugging, that replaceState is called in history. I think this is duplicate of https://github.com/rackt/react-redux/issues/217

Scarysize commented 8 years ago

Gonna mark this as dup to #219 and close it, so we don´t have multiple issues. And #219 seems more general.