Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Intentionally clearing a queryParam when persistQuery is true #223

Open
adamesque opened this issue Aug 22, 2017 · 0 comments
Open

Intentionally clearing a queryParam when persistQuery is true #223

adamesque opened this issue Aug 22, 2017 · 0 comments

Comments

@adamesque
Copy link

It looks like there's no way to intentionally clear a queryParam when you're also persisting the existing query. It'd be great if I could do something like

push({
  pathname: '/messages',
  query: {
    filter: 'business'
    page: null
  }
}, {
  persistQuery: true
});

to wipe out the page param but keep any other queryParams that may have been set on the url.

This would make it easy to have implicit or default values for queryParams, so that we'd never have to explicitly include a param for ?page=1, for instance.

Does that seem reasonable? Filtering out params that are set but with null or undefined values?
(We've also been mildly frustrated that empty string params are also passed through, but that may be a separate issue.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants