fix(frontend): keep query param when changing routes #674
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #671
This was introduced when we added baseUrl support, where we replaced the barebones
Router
forBrowserRouter
, which broke thereact-query-sync
library, since it doesn't expose thehistory
object which is handled under the hood.(see more details at Treora/redux-query-sync#13 (comment))
I spoke with @petethepig and the only reason we did that was to allow passing a
basename
, whichBrowserRouter
support.So I just replaced
BrowserRouter
forRouter
to getredux-query-sync
working (which is the may issue this PR resolves), and then adds the basename to the history object.The only thing here is that
basename
was removed fromhistory
from version 5 and onwards (remix-run/history#810), so that may become a problem. But it should be fine for now since we have a simple test that covers the functionality.Some other thoughts:
BrowserRouter
does not take ahistory
parameter (https://v5.reactrouter.com/web/api/BrowserRouter) which would probably raise an eyebrown.baseURL
stuff. Already spoken with @petethepig previously about doing it when we have more time, but honestly, this is the kind of thing we will forget if we don't do it soon.