prefetchInfinite on getServerSideProps using SSG helpers
I'm trying to implement pagination using infiniteQuery and SSR with trpc: -
getting the error in the picture, I followed christopher ehrlich's video
1 Reply
I have same code as you, more or less. It works. The error complains about you having issues in your env setup. Anyway, in case it help my code: export async function getServerSideProps() {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: { prisma } as any,
transformer: superjson, // optional - adds superjson serialization
});
const initialData = await helpers.discovery.getFollowingRecipes.prefetchInfinite({ limit: 20, cursor: 6 });
return {
// Passed to the page component as props
props: {
trpcState: helpers.dehydrate(),
},
revalidate: 60,
};