idempotentI
tRPC2y ago
1 reply
idempotent

How to disable Next.js draftmode in tRPC?

Hi guys, is it possible to disable the Next.js draft mode using tRPC?

I am tryin to achieve something such as this:
import { draftMode } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server';

export function GET(request: NextRequest) {
  draftMode().disable();
  const url = new URL(request.nextUrl);
  return NextResponse.redirect(new URL('/', url.origin));
}


But with tRPC, I tried calling draftMode().disable(); in my tRPC function but nothing happened, draftMode did not get disabled.
Was this page helpful?