const queryKey = ['someKey']
const enabled = ref(true) // used for the original query
const isEnabled = computed(() => { return enabled.value }) // used for the original query
export const useMyComposable = () => {
const queryClient = useQueryClient()
return useMutation({
mutationFn: () => myApi.deleteConfiguration(),
onSuccess: () => {
// This keeps the original data, and causes a refetch.
// queryClient.invalidateQueries({ queryKey, })
// This clears the original data, and causes a refetch.
// queryClient.resetQueries({ queryKey, exact: true })
// This removes the entire query but doesn't cause a redraw.
// queryClient.removeQueries({ queryKey, exact: true })
// This wont work because I want to set it to undefined, but undefined
// in this case causes setQueryData to do nothing.
// queryClient.setQueryData(queryKey, () => (undefined))
},
})
})
const queryKey = ['someKey']
const enabled = ref(true) // used for the original query
const isEnabled = computed(() => { return enabled.value }) // used for the original query
export const useMyComposable = () => {
const queryClient = useQueryClient()
return useMutation({
mutationFn: () => myApi.deleteConfiguration(),
onSuccess: () => {
// This keeps the original data, and causes a refetch.
// queryClient.invalidateQueries({ queryKey, })
// This clears the original data, and causes a refetch.
// queryClient.resetQueries({ queryKey, exact: true })
// This removes the entire query but doesn't cause a redraw.
// queryClient.removeQueries({ queryKey, exact: true })
// This wont work because I want to set it to undefined, but undefined
// in this case causes setQueryData to do nothing.
// queryClient.setQueryData(queryKey, () => (undefined))
},
})
})