tRPC query | mutation Error Boundary catch

With react query I can setup query client with default options for mutation and queries to useErrorBoundary: true and wrapping any components that uses a query/mutation with error boundary Im able to catch those errors. If I do the same for trpc react query query/mutations Im unable to catch those TRPCClientError errors when it throws. Is this expected? Do I need to do something extra? I though it works like reactquery and rethrow the errors but it seems it does not work like this ? Anyone had such problem ?
5 Replies
Abuzeid
Abuzeid2y ago
I think you can probably use async with catch error
Mik3y-F
Mik3y-F2y ago
@Mugetsu did you ever find an answer to this?
Mugetsu
Mugetsu2y ago
@Mik3y-F not yet. I was on holiday and will look into this/next week. I reported this also to trpc as an issue and they need some reproduction of issue. If you have some fairly simple setup of the project and could share it as a reproduction it could help track whats wrong. I have private repo which i need to strip down greatly before i could share (not sure if i will be able to). https://github.com/trpc/trpc/issues/3447
GitHub
bug: tRPC react query/mutation doesn't re-throw errors as reactQuer...
Provide environment information System: OS: macOS 11.7 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 347.80 MB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.18.1 - ~/.nvm/ver...
Mugetsu
Mugetsu2y ago
@Mik3y-F It turns out that the React version for me is the problem. I still use old one 16.8.6 and on 18.2.0 it works as expected
Mik3y-F
Mik3y-F2y ago
Thanks, got a solution on my end too
Want results from more Discord servers?
Add your server