* remove barrel export for client * fix more imports * remove server barrel * remove more barrel exporst and fix tssconfig * fix types * fix imports for removed barrels * fig ssg createserverside helpers * restore lock * new yarn lock * remove barel exports * remove barrel * replace client with react in tsconfig * fix yarn lock * Update exports for trpc to not be types * add ENDPOINTS export to the correct location * other exports fixes lost due to barrel * fix client error export * more imports --------- Co-authored-by: hbjORbj <[email protected]> Co-authored-by: Keith Williams <[email protected]>
28 lines
949 B
TypeScript
28 lines
949 B
TypeScript
"use client";
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { useState, type PropsWithChildren } from "react";
|
|
|
|
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
|
|
|
|
import { httpBatchLink } from "@trpc/client";
|
|
import { createTRPCReact } from "@trpc/react-query";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const mockedTrpc: any = createTRPCReact<AppRouter>();
|
|
export const StorybookTrpcProvider = ({ children }: PropsWithChildren) => {
|
|
const [queryClient] = useState(new QueryClient({ defaultOptions: { queries: { staleTime: Infinity } } }));
|
|
|
|
const [trpcClient] = useState(() =>
|
|
mockedTrpc.createClient({
|
|
links: [httpBatchLink({ url: "" })],
|
|
})
|
|
);
|
|
|
|
return (
|
|
<mockedTrpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
</mockedTrpc.Provider>
|
|
);
|
|
};
|