-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include tRPC client 'loggerLink' for dev debugging #296
Comments
Wait this appears to be broken now rip :( |
lol, do we still want this then? |
if its possible to get it working in both tRPC v9 and v10 (or only v10 i guess), i think it would be a good thing to add. those console outputs are nice to have by default. |
If we can get it working I definitely want it in dev mode |
Well, it worked here. But I had to use the That log really helps in development, and I also find the
|
@hnqg sorry just saw this now - yeah would be nice to add this I think |
tRPC already batches requests by default so adding an explicit httpBatchLink seems scary (in the way we prescribe a default for how big your batches should be) unless it's really needed? EDIT: Turns out it is needed, but we don't need to pass an explicit |
TIL that links order matters. here's the correct order links: [
loggerLink({
enabled: (opts) =>
isDevelopment() ||
(opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url,
headers: {
Authorization: `Bearer ${token}`
}
}),
], |
tRPC has an awesome logger client built in for React Query that is a lifesaver
Adding the following to the
_app.tsx
trpc config will add them in devThe text was updated successfully, but these errors were encountered: