T
TanStack3y ago
optimistic-gold

How to call onSettled function in new Tankstack query version 5

I have this function i want to run a function regardless query success or not. but i don't find anything about it in new version
function useFetchTiffImage(source) {
const { setMainImageIsLoaded } = useImageContext();
return useQuery({
queryKey: [source],
enabled: source?.includes(".tif"),

queryFn: () =>
axios({ url: source, method: "GET", responseType: "arraybuffer" })


// onSettled
});
}
function useFetchTiffImage(source) {
const { setMainImageIsLoaded } = useImageContext();
return useQuery({
queryKey: [source],
enabled: source?.includes(".tif"),

queryFn: () =>
axios({ url: source, method: "GET", responseType: "arraybuffer" })


// onSettled
});
}
4 Replies
conscious-sapphire
conscious-sapphire3y ago
it doesn't exist in v5
optimistic-gold
optimistic-goldOP3y ago
then what should i do in order to run the function ?? i didn't find anything on migrating documentation
conscious-sapphire
conscious-sapphire3y ago
did you read the linked RFC and blogpost? It depends on what you are doing in onSettled
optimistic-gold
optimistic-goldOP3y ago
oh i haven't read that thank you

Did you find this page helpful?