next.js
f5e35b87 - fix(after): allow reading draftMode status in after (#73324)

Commit
1 year ago
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)*
Author
Parents
Loading