T
TanStack11mo ago
correct-apricot

Declarative expected behavior or issue

Hello, I have the following case: - posts route has search params - use route masking for post details route to hide the search params - search params are persisted when navigating back from post details to posts Using imperative route masking works fine, but might mean duplicating code when having multiple ways to navigate from posts route to post details route. I tried using declarative route masking, but I'm not sure if I am using it correctly or if it might be an issue. When using like this, search params are persisted but are not masked:
const userRouteMask = createRouteMask({
routeTree,
from: '/users/$userId',
to: '/users/$userId',
params: (prev) => ({ userId: prev.userId }),
});
const userRouteMask = createRouteMask({
routeTree,
from: '/users/$userId',
to: '/users/$userId',
params: (prev) => ({ userId: prev.userId }),
});
Is it expected for the search params to not be masked when using declarative route masking? Reproduction here https://stackblitz.com/edit/tanstack-router-bnh3rw?file=src%2Fmain.tsx
1 Reply
vicious-gold
vicious-gold10mo ago
can you please create a GitHub issue to properly track this?

Did you find this page helpful?