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

removeDefaultsFromUrl: true doesn't take equals into account

meros opened this issue · comments

In removeDefaults.ts, I would expect equals to be used (if defined) to check for equality between default and encoded value. If there is no equals, shallowEqual should be used instead.

Now, when I set a value that is not ===, but equals() to the default, the param is still present in the URL for no reason.

+1.
I'm using the withDefault(NumericArrayParam, [0, 100]); with the removeDefaultsFromUrl but it is not removed from the URL when the value did not change.

Yes same on my side :)
Would definitely make sense to remove from params