Allow preview mode to work with Next.js cached components

Feature Idea (one per thread):

Currently the use of cookies for Prismic previews prevents pages from being loaded in Preview mode if they use cached components. I see from the source that Prismic previews use Next’s draftMode which prevents caching, but the error about accessing cookies still appears. It would be good to know if there is a workaround available, or if you have something in the pipeline that would allow this to work.

Issue that it solves:

Would allow pages that use cached components to be previewed.

Hey @prismic11,

Thanks for flagging this. Prismic previews in Next.js use Draft Mode, which is meant to disable normal caching behavior for preview requests. However, with Cache Components, Next.js can still raise errors when preview-related cookie access happens inside cached code paths.

At the moment, the safest workaround is to keep preview-aware fetching outside cached components/functions, and only cache subtrees that do not depend on preview cookies.

This looks tied to a current limitation in Next.js rather than a Prismic-specific preview setting. If Next.js expands Draft Mode support for dynamic APIs inside cached code paths, that should improve this use case significantly.