Mask Default Parameters in URL #2150
Replies: 4 comments
-
i found this: router/examples/react/basic-default-search-params/src/main.tsx Lines 145 to 156 in fcc278f |
Beta Was this translation helpful? Give feedback.
-
You can control this if you create a Route Mask for the routes you want to hide the searchParams from.
Unfortunately the masks seem to always reflect the last state of the masked route. I'm currently trying to get these route masks to reflect the current value of a navigation with declarative masks, rather than imperative masking - but that's a work in progress. |
Beta Was this translation helpful? Give feedback.
-
Also interested in this. |
Beta Was this translation helpful? Give feedback.
-
In the meantime I found a rather dirty solution that seems to work for my case.
If we stay on the same route and the At the time the function for the masks search params is invoked, the original route being masked has already been set as the When declaring a route mask the search option looks as follows:
This solution expects that the original route provides a value of the enum type I discovered this by trial and error and it currently doesn't feel like this is an officially supported way of doing this. I'd really appreciate if scenarios like these were supported though. I'm not a huge fan of this, but the real world effort to switch your routing structure in a production app that has grown might be huge and a soft migration path can ease that pain. |
Beta Was this translation helpful? Give feedback.
-
Hello,
i've a route with a lot of searchParams. now when i open the url all the parameters are appended. most of the searchParams are optional and i don't want users to see them all. i also dont want to serialize default values to the url.
is there a way to (mask?) the default parameter values?
Beta Was this translation helpful? Give feedback.
All reactions