Open Rykuno opened 1 year ago
Mmm i like this idea but i have to think through the api and see what's possible. I'll definitely try this out as soon as i have time
I just realized you can already achieve this with a custom encode and decode function
Describe the problem
For whatever reason some users try to modify our search params manually. We assume this mostly happens when a url not fully copied to the clipboard. Nonetheless you'll end up with a query that looks like
?sort=highes
for example; where the "t" is cutoff.At the moment we are the
default
parameter but that only adds a default value if the key is not present instead of checking if the value is valid it seems.We are currently checking this in our
onMount
like so; but it gets verbose when there are 15 keys to check for (search heavy data app).Describe the proposed solution
An api similar to the
default
feature that would not only check for a missing key, but check for its validity and set a default value if invalid.