pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.
https://pbeshai.github.io/use-query-params
ISC License
2.13k stars 95 forks source link

removeDefaultsFromUrl: true doesn't take equals into account #263

Open meros opened 1 year ago

meros commented 1 year ago

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.

juancho11gm commented 1 year ago

+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.

chrisbag commented 8 months ago

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