T
TanStack11mo ago
jolly-crimson

Navigating to subpage of page with search params

I have a page /company/$companyId, which uses validateSearch in its route, to validate search parameters for a table on the page. I am trying to build a subpage of that page /company/$companyId/profile/$profileId, but I can't. Trying to navigate like this:
navigate({
from: "/company/$companyId",
to: "/company/$companyId/profile/$profileId",
params: (prev) => ({
profileId: profileId,
companyId: prev.companyId,
}),
});
navigate({
from: "/company/$companyId",
to: "/company/$companyId/profile/$profileId",
params: (prev) => ({
profileId: profileId,
companyId: prev.companyId,
}),
});
I get a typeerror, until I define search, to true. If I navigate with search set to true, the URL changes, but nothing on the screen updates. I can see that the URL search params for the $companyId page remains at the end of the URL, even though the url is now at the $profileId page. Why is this?
1 Reply
extended-salmon
extended-salmon11mo ago
please provide a minimal complete example, e.g. by forking one of the existing examples on stackblitz

Did you find this page helpful?