Tester raised: API call gets called multiple times when getting empty response
Hi All,
I am using tanstack query in API calling, it was triggering multiple times when response was empty but status 200, moreover zod used for response data validation.
Can you please explain how to solve this..
2 Replies
helpful-purple•10mo ago
Without more details I don't know what's happening
One thing I can think of if the promise rejects it will automatically retry, but I can't really know without more details
foreign-sapphire•10mo ago
Is the problem that 1) it is triggering multiple times, or 2) the response was empty?
For 1), these are the triggers for a refetch per https://ui.dev/c/query/data-synchronization (paid)
- The
queryKey
changes
- A new injectQuery()
is created and the data is stale
- The window is focused
- Internet connection is restored
For 2) I do not know, but I doubt it would have anything to do with TanStack Query