is it possible to wildcat in Route Masking?
I want to create a masking that works for all routes.
i have a global dialog that is based on query params and i don't want this query to always reflect in the url, how can i implement this?
i.e
1. '/patient/?form=true' ::: '/patient'
2. '/calendar/?form=true' ::: '/calendar'
7 Replies
probable-pink•7mo ago
what you mean by "always"?
probable-pink•7mo ago
does https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#declarative-route-masking not work for you?
Route Masking | TanStack Router React Docs
Route masking is a way to mask the actual URL of a route that gets persisted to the browser's history and URL bar. This is useful for scenarios where you want to show a different URL than the one that...
fascinating-indigoOP•7mo ago
Yes ... but the issue is, i have to provide 'from' and 'to' which i want it to be global.
This query '?form=true' appears in almost all my routes
Which i will expect it to globally works for all my routes.
The use case here perfectly works for a single route, but in my case i have more that 40 routes that will have the same query. It doesn't make sense to create all 40 one after the other. What do you think?
probable-pink•7mo ago
would this work?
https://tanstack.com/router/latest/docs/framework/react/api/router/stripSearchParamsFunction
Search middleware to strip search params | TanStack Router React Docs
stripSearchParams is a search middleware that allows to remove search params. stripSearchParams props stripSearchParams accepts one of the following inputs: true: if the search schema has no required...
fascinating-indigoOP•7mo ago
No ... this is not masking.
is there a way to get all available routes, maybe i can map through and return
createRouteMask
of each route.
So sorry, i'm very new here.probable-pink•7mo ago
yes you can map over router.routesByPath
or routesById
fascinating-indigoOP•7mo ago
Thanks. I appreciate