Hi! I'm slowly converting code over to v10 - looks great! However, I ran in to an issue when using tRPC within my xstate state machine. I need to run a mutation in one of my states, and since this runs outside of react context, Alex had instructed for me to do the following in v9:
1. set the following property on
window
window
in
_app.tsx
_app.tsx
const trpcClient = trpc.useContext();
const trpcClient = trpc.useContext();
useEffect(() => { if (typeof window !== "undefined") { (window as any).trpcClient = trpcClient.client; } }, [trpcClient])
useEffect(() => { if (typeof window !== "undefined") { (window as any).trpcClient = trpcClient.client; } }, [trpcClient])
However this approach no longer works with v10. I was curious as to how I should approach this now? Thank you!
----
EDIT: should I just be creating a duplicate vanilla trpc proxy client with essentially the same configuration now? seems a bit redundant though...would be nice to be able to access my mutations like
I am setting up a refresh and access token for my app. The app retrieves the refresh token when the user signs in. The tokens are stored in Redux. The access token expires after 5 minutes. Before e...