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

ReduxRouter does not remove hashchange-listener on unmount #132

Open cwrs opened 9 years ago

cwrs commented 9 years ago

When unmounting an React-app with ReactDOM.unmountComponentAtNode() the hashchange-listener of createHistory is not removed. It is added by the history.listen call in client.js, but the returned unlisten-function is not stored and never called. Somehow the unlisten function needs to get called in ReduxRouter.componentWillUnmount().

As a quickfix, I added the unlisten-function to the returned store of historySynchronization() and called it from ReduxRouter.componentWillUnmount, but I guess thats not the best way to do it...

Thx for your help!