TanStackT
TanStack3y ago
5 replies
skinny-azure

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 
    });
}
Was this page helpful?