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
iDarkLightning8mo 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
tsuki8mo ago
cheers JinxHeart
zendev
zendev7mo 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
dan7mo 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
dan7mo 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
iDarkLightning7mo ago
lol
dan
dan7mo ago
oh whoops :p
zendev
zendev7mo ago
Yeah this is what I wanted to do but can’t find the queryClient config in the t3 setup
dan
dan7mo 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
zendev7mo ago
Perfect thanks mate
Want results from more Discord servers?
Add your server
More Posts