#How to call onSettled function in new Tankstack query version 5

5 messages · Page 1 of 1 (latest)

waxen finch
#

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 
    });
}
halcyon steeple
#

it doesn't exist in v5

waxen finch
#

then what should i do in order to run the function ??

#

i didn't find anything on migrating documentation

halcyon steeple
#

did you read the linked RFC and blogpost? It depends on what you are doing in onSettled