TanStackT
TanStack11mo ago
4 replies
inadequate-blush

Calling API and updating search params before loading a route

Hi, I have a case where BEFORE loading a route I'd really like to make some API call to check something and then update the searchParams based on the result.

Something like: click -> see loading -> API call in the background -> searchparams update -> route is loaded

What's the best way to achieve that? I tried beforeLoad for context update, but in middleware I only have access to the search params and not to context
Was this page helpful?