next-drupal
next-drupal copied to clipboard
#217: Add a local task to preview a node through next.js site.
@fiasco is attempting to deploy a commit to the Chapter Three Team on Vercel.
A member of the Team first needs to authorize it.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| next-drupal | ✅ Ready (Inspect) | Visit Preview | Aug 8, 2022 at 5:52PM (UTC) |
@fiasco This looks great. I've also been doing some work on this. I'll send a PR with some updates soon.
@fiasco How are you handling revisions in this case? Are you passing the revision id to the new route?
I haven't done any testing around revisions so I'm not sure yet. My plan was to look at that inline with content workflow logic. This, for now, is about seeing your site from the CMS.
Since JSON:API can only handle either the default revision or the latest revision, I've made a small update locally so that preview always pulls the latest revision rather than the default one. Upon testing though, I found a strange behaviour where the contents in the iframe would not update, but if I visit the same URL in a new tab, it would work.
Steps to reproduce:
- Edit content. In this case I edited the Person "Benicio Monserrate Rafael" from the Acquia CMS demo content and replace their name with my own "Josh Waihi" and saved it as a Draft revision. When previewing this though, it shows the original Persons name inside the preview suggesting an older revision is being shown.
- When I inspect the iframe, I can see its being passed a query parameter
resourceVersion=rel:working-copyand when I open the iframe URL in a new window, it works as expected.
But I don't really understand why Next.js would show something different in an iframe than it would in a new tab. @shadcn do you have any light you could shine on that?
I confirmed this bug only exists in dev mode and works fine from npm run start
@shadcn could you give this another review? From your perspective, what is holding this back from merge?
@fiasco I'll take a look at it. My main concern right now is how to merge this in a backward compatible way.
I've also been looking into this and trying to find a way to support entity revisions and handle multi-sites preview.