Reviewing the documentation for "Preview Content Changes" in Next.js. I noticed an error in the boilerplate code for the "useUpdatePreviewRef.js" hook.
Current code that passes the token "previewCookieRef" as a string:
else if (rawPreviewCookie && previewCookieRef) {
return router.push(`/api/preview?token=previewCookieRef&documentId=${documentId}`)
}
The working modified code that passes token "previewCookieRef" as a template literal:
else if (rawPreviewCookie && previewCookieRef) {
return router.push(`/api/preview?token=${previewCookieRef}&documentId=${documentId}`);
}
This change solved one of the issues I was running into when testing previews with Next.js.
Hit me up with any further questions.