T
TanStack•12mo ago
extended-salmon

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
xenial-black
xenial-black•12mo 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
extended-salmon
extended-salmonOP•12mo ago
Is this possible with the file based routing method?
xenial-black
xenial-black•12mo ago
of course
/files
index.tsx
$fileId.tsx
/files
index.tsx
$fileId.tsx
extended-salmon
extended-salmonOP•12mo ago
Thanks, I'll try this 🙂

Did you find this page helpful?