TanStackT
TanStack2y ago
2 replies
dramatic-maroon

validateSearch using async data

Hello,

I am building an app that rely on the selected project stored as “project_id” as a root search.

The project_id is a string but also requires additional validation (does the user has access to this project ?) that will be done in my root component directly.

If no project_id is passed, I want to default to the first project_id returned by the API for this user.

Is validateSearch a good place to query data and set the default search asynchronously ? Is there a better pattern ?

Thanks
Was this page helpful?