Nick
tRPC 10 Mutations Firing Twice in Deployed Releases Only
We have a newly-upgraded tRPC 10 / ReactQuery 4 app and on two pages on which we have a lot of mutations, the mutations are firing twice on click. This is not happening on other pages of our app.
This is not a case of double-click, we are already disabling the buttons on mutation commencement
This does not happen in local development; this only happens on Vercel preview deployments / prod deployments.
3 replies
TRPCContextState not found in v10
In our v9 app, we used TRPCContextState from internals to type out TRPC utils, importing it like
import { TRPCContextState } from '@trpc/react-query/dist/declarations/src/internals/context';
and using it in types like trpcUtils: TRPCContextState<AppRouter, any>;
Is there a quick alternative to this? Can't find it in the the latest trpc10 code packages.13 replies
Mutations and Queries in React Contexts causing unexpected behaviors
In my organization, we recently moved to put all of our mutations/queries into React Contexts and out of components (NextJS with React 18). I am now seeing requests and debouncing behaviors that used to work no longer work.
In some cases it appears we now have race conditions as loading/success are not necessarily being handled, but in other cases we're not getting reactivity from mutations that are in contexts Anyone else have experience or tips re: throwing tRPC stuff into React Contexts?
In some cases it appears we now have race conditions as loading/success are not necessarily being handled, but in other cases we're not getting reactivity from mutations that are in contexts Anyone else have experience or tips re: throwing tRPC stuff into React Contexts?
13 replies
Fetch errors on stale pages
Recently I have been getting a lot of fetch errors on stale pages, in particular ones that have queries running in React Contexts. I am on trpc 9.
This happens when I am on a page that has at least 1 tRPC query, then I leave that tab or I minimize the window, then I return to it. I get either a full-on internal server error document from Node or an econn refused error in these cases, NOT a trpc error.
1 replies
Change status of useMutation from 'success' back to 'idle'
Hiya, I have a mutation for creating stuff that can run a few different ways on a page, and I want to change its 'success' status back to 'idle' after 5 seconds. Is there a programmatic way to change a mutation's status from 'success' back to 'idle'?
3 replies
Handling Query Errors at Root of App (v9)
I want to show an error toast on my
NextJS
frontend every time there is an error from useQuery
in a functional component. Is there a way to add something at the root of my app that can watch for trpc errors or do I have to handle it at every use of useQuery
? (note: i am on v9)3 replies