Using tRPC browser-side only (and combining createCaller with react-query) #5751
Replies: 5 comments 3 replies
-
|
Hey, I'm running into the same issue trying to implemented React Server Components for next.js app router: https://trpc.io/docs/client/react/server-components#3-create-a-query-client-factory Did you make and progress on this error? |
Beta Was this translation helpful? Give feedback.
-
|
Make an issue and post a repro, would love for this to work |
Beta Was this translation helpful? Give feedback.
-
|
I'm not sure if we're experiencing the same issue with @brezzy1337. On my side, I would like to use trpc router on client-side only without any server. I reproduced the issue in this repository. Implementation is a bit naive, but It represents the issue |
Beta Was this translation helpful? Give feedback.
-
|
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
|
Very weird-I tried to use it the same as @lunacrafts here: https://github.com/capaj/faktorio/blob/5375b94a56d2a64226b4d0d3301b27e3efeb5215/faktorio-fe/src/App.tsx#L60 and it keeps crashing on whenever I try to call my test query endpoint. @KATT any ideas why it is resolving the fullpath to |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
First of all, I'd like to mention that I use tRPC in an unconventional way. Sometimes I write tRPC packages that are primarily initialized on the browser side, using flags
isServer: falseandallowOutsideOfServer: true. I mention this because it usually raises some questions, but this approach totally makes sense in some scenarios.The problem I am facing, which I believe should be solvable by more advanced users, is that when I initialize the code entirely on the browser side, I am unable to use it in conjunction with react-query.
Following example is a pseudo-code of potential usage.
Real-world code
Following code is a example from code-base. Connect method returns instance of tRPC client (result of caller() method, like in above example)
Beta Was this translation helpful? Give feedback.
All reactions