fix orpc templates (#302)

This commit is contained in:
Aman Varshney
2025-06-05 21:46:13 +05:30
parent a8ef5e8928
commit 2e6454ab33
15 changed files with 124 additions and 163 deletions

View File

@@ -20,8 +20,8 @@ import { toast } from "sonner";
import type { AppRouter } from "../../server/src/routers";
import { TRPCProvider } from "./utils/trpc";
{{else if (eq api "orpc")}}
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { orpc, ORPCContext, queryClient as orpcQueryClient } from "./utils/orpc";
import { QueryClientProvider } from "@tanstack/react-query";
import { orpc, queryClient } from "./utils/orpc";
{{/if}}
{{/if}}
@@ -99,7 +99,6 @@ const trpc = createTRPCOptionsProxy({
queryClient: queryClient,
});
{{else if (eq api "orpc")}}
const queryClient = orpcQueryClient;
{{/if}}
export const createRouter = () => {
@@ -127,9 +126,7 @@ export const createRouter = () => {
{{else if (eq api "orpc")}}
Wrap: ({ children }) => (
<QueryClientProvider client={queryClient}>
<ORPCContext.Provider value={orpc}>
{children}
</ORPCContext.Provider>
{children}
</QueryClientProvider>
),
{{else}}

View File

@@ -9,7 +9,7 @@ import { useQuery } from "@tanstack/react-query";
import { useTRPC } from "@/utils/trpc";
{{/if}}
{{#if (eq api "orpc")}}
import { useORPC } from "@/utils/orpc";
import { orpc } from "@/utils/orpc";
{{/if}}
{{/if}}
@@ -40,7 +40,6 @@ function HomeComponent() {
const trpc = useTRPC();
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
{{else if (eq api "orpc")}}
const orpc = useORPC();
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
{{/if}}