Gabriel Beltrão
Gabriel Beltrão
TtRPC
Created by Gabriel Beltrão on 11/26/2024 in #❓-help
Prefetch using Next App router not working with useQuery but works with useSuspenseQuery
Any help? :/
5 replies
TtRPC
Created by Gabriel Beltrão on 11/26/2024 in #❓-help
Prefetch using Next App router not working with useQuery but works with useSuspenseQuery
"use server";

import { createServerSideHelpers } from "@trpc/react-query/server";
import { appRouter } from "./root";
import { createTRPCContext } from "./trpc";
import SuperJSON from "superjson";
import { createContext } from "@/trpc/server";

/**
* SSR helpers (for prefetching data on the server)
* https://trpc.io/docs/client/nextjs/server-side-helpers
*/
export const createSSRHelper = async () =>
createServerSideHelpers({
router: appRouter,
ctx: await createContext(),
transformer: SuperJSON,
});
"use server";

import { createServerSideHelpers } from "@trpc/react-query/server";
import { appRouter } from "./root";
import { createTRPCContext } from "./trpc";
import SuperJSON from "superjson";
import { createContext } from "@/trpc/server";

/**
* SSR helpers (for prefetching data on the server)
* https://trpc.io/docs/client/nextjs/server-side-helpers
*/
export const createSSRHelper = async () =>
createServerSideHelpers({
router: appRouter,
ctx: await createContext(),
transformer: SuperJSON,
});
5 replies
TtRPC
Created by Gabriel Beltrão on 11/26/2024 in #❓-help
Prefetch using Next App router not working with useQuery but works with useSuspenseQuery
For context, i'm also using SSR Helpers, as seen on the page.tsx, and this is my simple implementation:
5 replies