T
tRPC

Why useQuery() tries to refetch when error occurs while useMutation() doesn't?

Why useQuery() tries to refetch when error occurs while useMutation() doesn't?

AAerys9/27/2023
I'm using the T3 stack.
test: publicProcedure.input(z.string().min(5)).query(async () => {
return "hi!";
}),
test: publicProcedure.input(z.string().min(5)).query(async () => {
return "hi!";
}),
const { error } = api.user.test.useQuery("test");
const { error } = api.user.test.useQuery("test");
(it should return a Zod validation error) the client tries to refetch 3 times and then returns the error (4-5 seconds of delay), throughout the process the error is logged by the loggerLink, but the error returned takes a while, but when I switch to useMutation() the error is returned rather instantly, what could be root?
Solution:
This is a feature of react query, you'll find retry details in their docs
Jump to solution
Solution
Nnlucas9/27/2023
This is a feature of react query, you'll find retry details in their docs
AAerys9/27/2023
oh you're right, just disabled it, thanks for help! 🤟

Looking for more? Join the community!

T
tRPC

Why useQuery() tries to refetch when error occurs while useMutation() doesn't?

Join Server