Jokcy
Explore posts from serversIs there any easy way to create a Type for a trpc router
I want to publish a set of trpc api client to npm, which will be used by my customer directly. But if I use
typeof MyRouter
to infer the Router type, my bundler (which is tsup) will bundle db schema types into the d.ts file. If I want my customer to gain the typesafe ability I have to make my db schema info public. Is there any way to define a Router type without typeof MyRouter
type infer? So that I can expose limited info to public.3 replies
Cache not working for `useQuery`
I have a query like this:
which
targetId
is a dynamic value. When I change targetId
from a to b then switch back from b to a, the useQuery
hook still send a new request for a
instead of using cache. Any idea how to make the cache work?6 replies
Demo code `trpc.infinitePosts.add` on infinitedQuery not working
Doc here: https://trpc.io/docs/useInfiniteQuery#getinfinitedata, I created an my query like this:
Then on my client:
api.post.infinitePosts
, but there is no .add
or .delete
on it, am I miss something or is there any detail doc?1 replies