TanStackT
TanStack3y ago
2 replies
moderate-tomato

await query without fetching it

I have a component that uses a
useQuery
for a given query.
In order to handle user input, I need to use that data. I don't want to just error in the event that the data is not yet fetched, or discard the input.

I know I can just use await queryClient.fetchQuery(blah) in the user input handler. but my understanding is that this will make a second network request, if the first one (from the hook) hasn't returned yet. is that true? I know it won't if there's already data that isn't stale.
Was this page helpful?