pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.

Home Page:https://pbeshai.github.io/use-query-params

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preventing history push when setQuery didn't actually result in any url changes

PEsteves8 opened this issue · comments

Hi,

The library works great, but I'm using a custom adapter to compare the state of the URL before actually allowing a navigate call.

The thing is that it's sometimes easier to just call setQuery in certain circumstances without worrying about whether or not anything changed. The issue is that this creates history entries that don't do anything. So sometimes after rendering a screen, to go back, you'd have to hit back a few times before actually reaching the real previous url state.

My current solution works well, but I'm wondering if this feature is available and I haven't found it, or if it's deliberately been left out for some technical reason. Or maybe I'm just not designing my features ideally and this isn't really a need if one designs things properly.

Thanks for your work,
Paulo

Good idea, thanks! Added in v2.1.0

Wow that was fast haha. Thanks!