mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
`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)*
9 lines
191 B
JavaScript
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()
|
|
}
|