TanStackT
TanStack15mo ago
1 reply
ordinary-sapphire

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,
  }),
});

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?
Was this page helpful?