DevThoughts
DevThoughts15mo ago

where is useQuery [key]?

Learning trpc, i use to tanstack with queryKey, can not find how that works with trpc, if i want to revalidate my query? const query = useQuery({ queryKey: ['todos'], queryFn: getTodos })
Solution:
useContext | tRPC
useContext is a hook that gives you access to helpers that let you manage the cached data of the queries you execute via @trpc/react-query. These helpers are actually thin wrappers around @tanstack/react-query's queryClient methods. If you want more in-depth information about options and usage patterns for useContext helpers than what we provide...
Jump to solution
4 Replies
Nick
Nick15mo ago
Nick
Nick15mo ago
We have a dedicated integration, which also has the ability to get query keys if you need (but we do it for you)
DevThoughts
DevThoughts15mo ago
Yes, i have been reading the docs. How do i invalidateQueries when i use useMutation? i don't know my queryKey name? Thank you.
Solution
Nick
Nick15mo ago
useContext | tRPC
useContext is a hook that gives you access to helpers that let you manage the cached data of the queries you execute via @trpc/react-query. These helpers are actually thin wrappers around @tanstack/react-query's queryClient methods. If you want more in-depth information about options and usage patterns for useContext helpers than what we provide...
More Posts
useInfinieQuery with initialData, Refetch only after second change of inputsHi everyone, I have the problem as stated in the title. My code looks like the following: ```ts Adding tRPC HOC breaks zustandIt seems that adding the trpc hoc breaks my zustand stores initial values and generates bad data. AfNext.js + tRPC, multitenancy, access Next.js Router when setting tRPC headersHey all! I'm writing a multi-tenant solution. Most Next.js pages lie under the `/pages/[tenantKey]/`getInfiniteData returns undefinedI am using the t3-stack. Whenever I am calling getInfiniteData it returns undefined. ``` console.loEnable both `useQuery` and a raw `query` from the frontend (for use in async validation)Hello everyone, some context: ``` . I'm building a project with a variant of the t3 stack (key pointNextjs http endpoint (no prisma)I have simple pages/api/todoEndpint how do i call this endpoint with trcp? I don't want to use prismAdding clerk auth object to createServerSideHelpersSo I followed clerk's docs for TRPC (https://clerk.com/docs/nextjs/trpc) and I added `auth` to the `Call retries were exceeded with ssgI'm running a `create-t3-app` on Node 18. Has anyone seen errors trying to use SSG with TRPC and PrHow does batching work in SSR & nextjs app directory?I'm currently playing with the app directory for nextjs. If I have a SSR client set up like this: `"This is likely not portable" errorRandomly started getting this weird error on my front end, can't find anything online on it. Somethi