tmy03
tmy03
TtRPC
Created by tmy03 on 11/23/2023 in #❓-help
TypeError: queryClient.getMutationDefaults is not a function (it is undefined)
Nevermind. I was using a @tanstack/react-query version 5. Downgraded to 4 and everything works.
5 replies
TtRPC
Created by tmy03 on 11/23/2023 in #❓-help
TypeError: queryClient.getMutationDefaults is not a function (it is undefined)
I'm using tRPC version 10.43.6
5 replies
TtRPC
Created by tmy03 on 11/23/2023 in #❓-help
TypeError: queryClient.getMutationDefaults is not a function (it is undefined)
The error happens in here trpc/packages/react-query/src/shared/hooks/createHooksInternal.tsx, line 347 on queryClient.getMutationDefaults:
function useMutation(
// FIXME: this should only be a tuple path in next major
path: string | [string],
opts?: UseTRPCMutationOptions<unknown, TError, unknown, unknown>,
): UseTRPCMutationResult<unknown, TError, unknown, unknown> {
const { client } = useContext();
const queryClient = useQueryClient({ context: ReactQueryContext });
const actualPath = Array.isArray(path) ? path[0] : path;

const defaultOpts = queryClient.getMutationDefaults([
actualPath.split('.'),
]);
function useMutation(
// FIXME: this should only be a tuple path in next major
path: string | [string],
opts?: UseTRPCMutationOptions<unknown, TError, unknown, unknown>,
): UseTRPCMutationResult<unknown, TError, unknown, unknown> {
const { client } = useContext();
const queryClient = useQueryClient({ context: ReactQueryContext });
const actualPath = Array.isArray(path) ? path[0] : path;

const defaultOpts = queryClient.getMutationDefaults([
actualPath.split('.'),
]);
5 replies