mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
feat: migrate nextjs to rr7
This commit is contained in:
@ -1,8 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import type { QueryClientConfig } from '@tanstack/react-query';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { httpBatchLink, httpLink, splitLink } from '@trpc/client';
|
||||
import { createTRPCReact } from '@trpc/react-query';
|
||||
@ -10,6 +7,7 @@ import SuperJSON from 'superjson';
|
||||
|
||||
import { getBaseUrl } from '@documenso/lib/universal/get-base-url';
|
||||
|
||||
// import { getBaseUrl } from '@documenso/lib/universal/get-base-url';
|
||||
import type { AppRouter } from '../server/router';
|
||||
|
||||
export { getQueryKey } from '@trpc/react-query';
|
||||
@ -39,27 +37,7 @@ export interface TrpcProviderProps {
|
||||
}
|
||||
|
||||
export function TrpcProvider({ children, headers }: TrpcProviderProps) {
|
||||
let queryClientConfig: QueryClientConfig | undefined;
|
||||
|
||||
const isDevelopingOffline =
|
||||
typeof window !== 'undefined' &&
|
||||
window.location.hostname === 'localhost' &&
|
||||
!window.navigator.onLine;
|
||||
|
||||
if (isDevelopingOffline) {
|
||||
queryClientConfig = {
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
networkMode: 'always',
|
||||
},
|
||||
mutations: {
|
||||
networkMode: 'always',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const [queryClient] = useState(() => new QueryClient(queryClientConfig));
|
||||
const [queryClient] = useState(() => new QueryClient());
|
||||
|
||||
const [trpcClient] = useState(() =>
|
||||
trpc.createClient({
|
||||
|
||||
Reference in New Issue
Block a user