Recommendations for Zod validated Nested Search Params
I made this minimal example (see the /about route) that shows off some of the tricky pieces I can't seem to work around:
1. any params that use the
fallback() function from @tanstack/zod-adapter force their key into the URL (which is just preference, but clutters up the URL bar)Should I just accept that the URL is going to be a little ugly? Or do I have to give up the type safety to achieve it?
2. nested objects that use
fallback() have to wrap every single key in the generic function, leading to defining the default values N timesAre deeply nested search params considered a good practice? Or is there some way to avoid needing to duplicate default values over and over?
To demonstrate the nesting issue:
Curious if there is a better way!
SOLVED: upgrading to Zod v4 removes the need to use the
fallback generic function.