Nacho Elias
Zod formatting Error
I'm using Zod for validation and whenever I get a validation error I'd like to be able to get the error message properly formatted. In the docs there's a section for this where it's sepcified that we can use the errorFormatter to achieve this. However, it's not doing anything at all. Btw, if I add a console.log within the errorFormatter nothing's being shown in the console, which is kind of weird if you ask me. However superjson is working completely fine, so I dont think its a configuration problem....
Here's my code
This is my validation
And this is what I get in my client in error.message instead of "Invalid ID"
4 replies
Zod error not being formatted
I'm using Zod for validation and whenever I get a validation error I'd like to be able to get the error message properly formatted. In the docs there's a section for this where it's sepcified that we can use the errorFormatter to achieve this. However, it's not doing anything at all. Btw, if I add a console.log within the errorFormatter nothing's being shown in the console, which is kind of weird if you ask me. However superjson is working completely fine, so I dont think its a configuration problem....
Here's my code
This is my validation
And this is what I get in my client in error.message instead of "Invalid ID"
2 replies
Which http library trpc uses in the frontend?
I was wondering if
trpc
uses the Fetch API
or uses something like Axios
to do API calls from the frontend. I recently added supertokens
to an app and I need to add a middleware for session refreshment depending on the tool I'd be using3 replies
useQueryClient is not working as expected
So before v10 I was simply using useQueryClient and had my
queryClient
strongly typed. Now I moved to v10 and for some reason, the documentation says that the queryClient was removed from the context so I should use the useQueryClient hook directly from @tanstack
but if I do so then the queryClient returned by that hook is not the queryClient trpc
is using, it's just empty. I made it work by using the trpc.useContext
hook coming from my client utils but I definitely think that the docs are a bit f*cked up.71 replies