TanStackT
TanStack7mo ago
5 replies
urgent-maroon

Redirect to same route

When I try to redirect to the same route with a new search object it doesn't keep the search parameter from the redirect. I have tried with my mask and without it.

  beforeLoad: async ({ search }) => {
    console.log({ beforeLoad: search });
    if (search.code && search.state) {
      console.log('redirecting');
      throw redirect({
        to: '.',
        search: { showPriority: true },
      });
    }
  },


  const search = Route.useSearch();
  console.log({ priority: search });


Outputs the logs
beforeLoad: { code: ..., state: ... }
'redirecting'
beforeLoad: { showPriority: true }
priority: {},
priority: {},
Was this page helpful?