reactjs/react-router-redux

Ability to modify 'location' with my own reducer?

Rob-ot opened this issue · 1 comments

Hey all, thanks for making this library, it feels great to finally have router state in redux.

I'm in a situation where I'd like to modify the 'location' in the store with my own reducer. When I try to modify it now, the store is updated but the url change is not reflected in the browser.

Here's the situation:
I have an action+reducer that runs to handle an api response that includes a list of images. In our app, the images can be reordered and we want to have the image order stored in the url for easy sharing.
So ideally, the same reducer that handles the image response also adds the ordered list of images to the url in the redux store, and as users reorder the images the url is updated.
This doesn't work though. I've also tried using redux-thunk to dispatch the url change separately but it doesn't have access to the store to get the list of ids.

Please let me know what you think and if this is possible, or if there's a better approach. Thanks!

The store state isn't bidirectional. Either dispatch the appropriate action or don't use this library (you shouldn't) and talk directly to the router/history.