T
TanStack4y ago
eastern-cyan

AbortSignal for useQueries

In useQuery a context is passed to the queryFn which provide an abort signal that can be consumed by eg. axios. When using useQueries (plural) the context is not passed to the queryFn. Is there a way to send the abort signal to all the requests made by useQueries ?
1 Reply
genetic-orange
genetic-orange4y ago
the context is passed to each queryFn just like for useQuery ...
useQueries(myThings.map(thing => ({
queryKey: ['thing', thing.id],
queryFn: (context) => ...
}))
useQueries(myThings.map(thing => ({
queryKey: ['thing', thing.id],
queryFn: (context) => ...
}))

Did you find this page helpful?