T
TanStack•9mo ago
harsh-harlequin

Prevent search params from being inherited?

Can I make search params not being inherited in nested routes? I have a page /files which receives a bunch of search params for filtering and ordering files. Then I have a route /files/$fileId and it makes no sense to have search params for that route.
4 Replies
other-emerald
other-emerald•9mo ago
search params cannot be NOT inherited but you probably need an index route that has the search params instead of defining them on /files then they are not inherited since the index and $fileId are siblings
harsh-harlequin
harsh-harlequinOP•9mo ago
Is this possible with the file based routing method?
other-emerald
other-emerald•9mo ago
of course
/files
index.tsx
$fileId.tsx
/files
index.tsx
$fileId.tsx
harsh-harlequin
harsh-harlequinOP•9mo ago
Thanks, I'll try this 🙂

Did you find this page helpful?