FormidableLabs / redux-little-router

A tiny router for Redux that lets the URL do the talking.
MIT License
1.04k stars 114 forks source link

`persistQuery` option doesn't work with `push` action creator #224

Closed adamesque closed 6 years ago

adamesque commented 7 years ago

As alluded to in #172, it looks like the persistQuery option doesn't work when you dispatch a push action directly.

From what I can tell, when you dispatch push directly, it immediately hits the middleware, which updates the url immediately with the unmerged query. After this happens, the action hits the reducer, which then merges the existing query params with the new ones and updates the redux store.

I'm not familiar enough yet with Redux to know what the correct thing to do here is except make the middleware do the merging before calling any history methods.