will try this library next time, seems to solve nicely for things that are not too deeply nested. The part I like about the existing setup is I can use zod for validation etc.
If it ain’t broke, don’t fix it, but if you do decide to try it out, URL State Codecs accepts user-defined value codecs that have a similar shape to what you have above. The only difference is that the return type would need to be wrapped in a Result object (similar to Zod’s safeParse() return type), which I recommend using with try/catch wherever errors are liable to occur.
I would have liked to see an example or description of how the data is actually encoded.
Good feedback, thanks. Added a demo video of an integration, an example of the encoded output, and some other details to the README.
had a similar usecase, decided to use https://github.com/paoloricciuti/sveltekit-search-params
will try this library next time, seems to solve nicely for things that are not too deeply nested. The part I like about the existing setup is I can use zod for validation etc.
If it ain’t broke, don’t fix it, but if you do decide to try it out, URL State Codecs accepts user-defined value codecs that have a similar shape to what you have above. The only difference is that the return type would need to be wrapped in a Result object (similar to Zod’s
safeParse()return type), which I recommend using with try/catch wherever errors are liable to occur.