onSuccess, onError and onSettled deprecated next major version?

with onSuccess, onError and onSettled being deprecated soon™️, what would the best practice be for triggering side effects, when a trpc call is successful? i should clarify, i'm not talking about putting the returned data in state. i'm talking about refreshing a route in a "use client" component with next/router, or toggling a boolean in a jotai store.
No description
Solution:
Breaking React Query's API on purpose
Why good API design matters, even if it means breaking existing APIs in the face of resistance.
Jump to solution
10 Replies
Solution
iDarkLightning
iDarkLightning13mo ago
Breaking React Query's API on purpose
Why good API design matters, even if it means breaking existing APIs in the face of resistance.
tsuki
tsukiOP13mo ago
cheers JinxHeart
zendev
zendev13mo ago
Hi just read through the article, everything makes sense but in the t3 setup there isn’t a way to do what they did regarding toasting an error, bc the onError callback from trpc occurs on the server side, inside the pages/api folder? I could very well be wrong but could someone enlighten me on how to do useQuery error handling w trpc?
dan
dan13mo ago
Breaking React Query's API on purpose
Why good API design matters, even if it means breaking existing APIs in the face of resistance.
dan
dan13mo ago
The RQ api got changed, removing the onError/onSuccess callbacks. There is examples on that page of handling errors now with use effect or at teh queryClient level
iDarkLightning
iDarkLightning13mo ago
lol
dan
dan13mo ago
oh whoops :p
zendev
zendev13mo ago
Yeah this is what I wanted to do but can’t find the queryClient config in the t3 setup
dan
dan13mo ago
if you're using pages then inside utils/api you can set the queryClientConfig prop. on app then you just pass it into the new QueryClient(config) inthe root
zendev
zendev13mo ago
Perfect thanks mate
Want results from more Discord servers?
Add your server