(
props: Readonly<{
children: React.ReactNode;
}>,
)
| 31 | return `${base}/api/trpc`; |
| 32 | } |
| 33 | export function TRPCReactProvider( |
| 34 | props: Readonly<{ |
| 35 | children: React.ReactNode; |
| 36 | }>, |
| 37 | ) { |
| 38 | // NOTE: Avoid useState when initializing the query client if you don't |
| 39 | // have a suspense boundary between this and the code that may |
| 40 | // suspend because React will throw away the client on the initial |
| 41 | // render if it suspends and there is no boundary |
| 42 | const queryClient = getQueryClient(); |
| 43 | const [trpcClient] = useState(() => |
| 44 | createTRPCClient<AppRouter>({ |
| 45 | links: [ |
| 46 | httpBatchLink({ |
| 47 | transformer: superjson, |
| 48 | url: getUrl(), |
| 49 | }), |
| 50 | ], |
| 51 | }), |
| 52 | ); |
| 53 | return ( |
| 54 | <QueryClientProvider client={queryClient}> |
| 55 | <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}> |
| 56 | {props.children} |
| 57 | </TRPCProvider> |
| 58 | </QueryClientProvider> |
| 59 | ); |
| 60 | } |
nothing calls this directly
no test coverage detected