react-query-swagger
react-query-swagger copied to clipboard
TypeError: this[#client].defaultMutationOptions is not a function
I've successfully integrated all my Get calls and got to the Post mutations now. I'm using NextJs 13.3.2 As soon as I make a call to the mutation I get an Unhandled Runtime Error
Unhandled Runtime Error TypeError: this[#client].defaultMutationOptions is not a function
A brief example of my mutation call: const addContentMutation = useContentControllerCreateContentMutation();
Help is appreciated
Apparently, it's an error with TenStack Query 5, everything works fine with V4. Will there ever be a V5 support update?
Thanks!
Oh, I missed v5 release! Thanks for mentioning that. I'll work on it coming week
version 15.10.1 should have support for Tanstack Query v5
I also experience the same issue even though I updated to the latest (15.10.1) version. There are no issues with @tanstack/react-query v4 though.
calling mutations from example app works for me now. Do you still experience the issue? Could you share your OpenAPI definition?
I am using these packages
"@tanstack/react-query": "5.8.4",
"@tanstack/react-query-devtools": "5.8.4",
"@tanstack/react-query-persist-client": "5.8.4",
"react-query-swagger": "15.10.3",
and the error I see when trying to run the TypeScript compiler (tsc
) is the following
Property 'isLoading' does not exist on type 'UseMutationResult<unknown, Error, void, unknown>'
I am using it like this:
const { isLoading: isLoadingStart, mutate: handleStart } = useMutation(() =>
someFn({
arg1,
arg2: {
arg3: ''
}
})
);
what is the version excatly?
what is the version excatly?
If this is related to my post above, I’ve already posted the versions 😄
Yep, still have the same issue. Latest V5.
I have similar issue, I solved it using new sintax on V5, need to pass an Object for options. Try something like:
useMutation({ mutationFn: your_function_here })
I have similar issue, I solved it using new sintax on V5, need to pass an Object for options. Try something like:
useMutation({ mutationFn: your_function_here })
yeah this worked for me, thanks
you need to have something like this:
const { mutate } = useMutation({ mutationFn: your_functionName, onSuccess: () => {}, });
Note the use of mutationFn
Apparently, it's an error with TenStack Query 5, everything works fine with V4. Will there ever be a V5 support update?
Thanks!
close the the issue if its solved and mark the answer
I too had the same issue in v5 Did resolve this by keeping it as : const { mutate } = useMutation({ mutationFn: your_functionName, onSuccess: () => {}, });
Hi everyone......in React Query V5 should work.....the problem is the availability of query client....this have worked for me!
export const useSignInMutation = () => useMutation({mutationFn: AuthApi.signIn}, queryClient);
I am using Vue one @tanstack/vue-query
I have latest packages:
"@tanstack/vue-query": "^5.59.13",
i get this error:
Uncaught (in promise) TypeError: client.defaultQueryOptions is not a function
at ComputedRefImpl.fn (chunk-XV6XIJVG.js?v=897b9526:3988:30)
at refreshComputed (chunk-TF6X5W6F.js?v=897b9526:634:29)
at get value (chunk-TF6X5W6F.js?v=897b9526:1825:5)
at useBaseQuery (chunk-XV6XIJVG.js?v=897b9526:3992:58)
at useQuery (chunk-XV6XIJVG.js?v=897b9526:4082:10)
at useUpload (user.ts:8:10)
at setup (UserDetails.vue:56:26)
at callWithErrorHandling (chunk-TF6X5W6F.js?v=897b9526:2260:19)
at setupStatefulComponent (chunk-TF6X5W6F.js?v=897b9526:9943:25)
at setupComponent (chunk-TF6X5W6F.js?v=897b9526:9904:36)
main.ts:
app.use(VueQueryPlugin, {
queryClientConfig: {
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 0
}
}
}
});
I solved my downgrade the version to :
"@tanstack/vue-query": "^4.37.1",
I hope to fix this issue
I also created issue here https://github.com/TanStack/query/issues/8198