Feature Request: Immutable react-router-redux
See original GitHub issueWe use combineReducers from redux-immutable which isn’t playing nicely with the latest v5 alpha of react-router-redux.
I was hoping to be able to just let the router slice of the state tree stay as a plain JS object seeing as all interactions with it will be via react-router-redux and there aren’t any performance gains from using immutable props without refactoring all the components but that doesn’t work.
The problem occurs where the reducer uses Object.assign to merge the new location payload with the state. I get One of the sources for assign has an enumerable key on the prototype chain. Are you trying to assign a prototype property? ....
Anyway, it would be great if you could import an immutable reducer and selectors e.g.
import { routerReducer } from 'react-router-redux/immutable'
I forked the repo here and added the above exports which allowed me to do:
import { routerReducerImmutable } from 'react-router-redux'
This appeared to work at first and I was able to dispatch the LOCATION_CHANGE actions using the push() action creator. However this was using npm link and when I moved the code into it’s own repo on github (which I had to do because it is nested in packages), my app crashes on push. It’s really hard to work out why, the CALL_HISTORY_METHOD appears to hit the middleware but it doesn’t hit an error, just crashes. This is react-native app by the way.
Anyway, are there any plans to add this? I will try to get my fork working and tidied up for a pull request but thought it was worth raising an issue to see if there is much support for this feature and whether I can get any help with it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)

Top Related StackOverflow Question
Also, it looks like the old instructions don’t apply. There is no
syncHistoryWithStoreorselectLocationStateoption to provide your own selector. Neither string occurs anywhere in my node_modules. Although, looking at the source, nothing actually usesstore.locationanyway so I guess just providing your own immutable reducer is enough but that kind of leads me back to the point above… If the store can’t be relied on as a source of truth, what’s the point ofreact-router-redux?I’m not sure about previous versions but appears that this one doesn’t use the
state.routingdata at all. It only keeps it updated with the history state and provides a mechanism to update both by dispatching actions. Essentially the history (memoryHistory, browserHistory or whatever) is the source of truth so there is no need to provide a selector and it’s up to you what your reducer does withLOCATION_CHANGEactions