cornpopguy
cornpopguy
TtRPC
Created by cornpopguy on 5/2/2024 in #❓-help
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));
}
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.
2 replies