-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft Mode Preview Not Working with New Implementation #8708
Comments
Thanks for catching this, the fix here is to pass See #8714 for the change |
paulpopus
added a commit
that referenced
this issue
Oct 15, 2024
Awesome. Thanks for the quick fix! |
🚀 This is included in version v3.0.0-beta.115 |
This issue has been automatically locked. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Link to reproduction
No response
Environment Info
Payload: 3.0.0-beta.113
Node.js: v22.9.0
Next.js: 15.0.0-canary.173
Describe the Bug
Hello Payload CMS team,
I'm experiencing issues with the new draft mode preview implementation from the website template. The previous solution was working fine, but after updating to the new recommended approach, I can no longer access draft posts.
Previous working implementation:
New implementation (not working):
With the new implementation, I can no longer access draft posts. The preview functionality doesn't work as expected, as the LivePreview is not loading and the Preview gives me "Document not found".
When the page or post is already published it is working perfectly fine, though. It routes to the correct slug and the LivePreview is also working flawlessly.
I've noticed that I have the next folder with the preview routes in the app folder and in the website template it is in the frontend folder. When I put it there for testing purposes, it completely broke the preview, as I wasnt able to even access live pages/posts anymore.
Reproduction Steps
Reproduction Steps:
Setup:
Implement the original (working) preview route:
app/next/preview/route.ts
with the code from above (see first example)Test the original implementation:
Update to the new (non-working) preview route:
app/next/preview/route.ts
with the code from above (see second example)Update collection configuration:
pages.ts
orposts.ts
), ensure theadmin.preview
function is set up correctly:Test the new implementation:
Check for errors:
GET /next/preview?slug=testartikel&collection=news&path=%2Fnews%2Ftestartikel 403 in 925ms
Additional tests:
Expected result: The preview should successfully load draft content for authenticated users.
Actual result: The preview fails to load draft content, and draft posts/pages are inaccessible.
Adapters and Plugins
No response
The text was updated successfully, but these errors were encountered: