Files
Janka UrygaandGitHub f5e35b87b9 fix(after): allow reading draftMode status in after (#73324)
`after` was too restrictive with `draftMode` -- we generally allow reading `draftMode().isEnabled` anywhere. this is because it isn't really a dynamic API -- it's fine to call it in prerender/'use cache' contexts, because we can just prerender/cache it as `isEnabled = false`, and when it's on, it switches everything to dynamic rendering anyway, so that prerender/cache entry is ignored.

However we disallow `draftMode().enable()/disable()` in `after`, because those methods set a cookie, and `after` executes too late for that.

*(Nothing here will change in the upcoming `after` behavior update -- we fundamentally can't get more permissive than this)*
2024-11-29 11:31:53 +01:00

9 lines
191 B
JavaScript

import { testDraftMode } from '../helpers'
export const dynamic = 'force-static'
export async function GET() {
testDraftMode('/draft-mode/route-handler-static')
return new Response()
}