Invoking onError callback from useQuery #6947
-
Hi teamI know this issue has been answered in varying ways but just as the answer presents itself the issue is closed so I am hoping to get an answer related to title. I am trying to unit test my QueryClientProvider and provided what that looks like below.
From the documentation I know the onError call back is invoked with a Rejected promise so i created a custom hook for that.
The issue I am facing is there doesn't seem to be any change to the query cache itself and any error functions return false. I am looking for a way to invoke that onError call back to trigger the global banner component within the query cache (and subsequently mutation cache when it comes to it) Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
queryFn
returns a rejected Promise? Why not just do: `() => Promise.reject(new Error("Error"))