silverwolf-x's picture
download
raw
544 Bytes
import { draftMode } from 'next/headers'
export default async function Page() {
return (
<>
<p>
This page enables draft mode in `'use cache'`, which triggers an error.
</p>
<DraftModeEnablingComponent />
</>
)
}
async function DraftModeEnablingComponent() {
'use cache'
// Enabling draft mode in a cache context is not allowed. We're try/catching
// here to ensure that this error is shown even when it's caught in userland.
try {
;(await draftMode()).enable()
} catch {}
return null
}

Xet Storage Details

Size:
544 Bytes
·
Xet hash:
801e8972b2c9c9c9db2503dde4754b7a1e5dd7e5994c850917123d8f85f89064

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.