T
TanStack3mo ago
correct-apricot

Conditional route masking based on path params

Hi, I have a use case where I would like to mask the URL from /app/views/$viewId/feature-x to /app/feature-x when $viewId === 'hidden'. I have tried using the createRouteMask function with the params function, but it masks every route regardless of their $viewId path param. Is it this possible to do using masking, or is there perhaps another feature that covers that case?
createRouteMask({
routeTree,
from: `/app/views/$viewId/feature-x`,
to: `/app/feature-x`,
params: (prev) => {
if(prev.viewId === 'hidden') return prev

return false
}
})
createRouteMask({
routeTree,
from: `/app/views/$viewId/feature-x`,
to: `/app/feature-x`,
params: (prev) => {
if(prev.viewId === 'hidden') return prev

return false
}
})
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?