next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

#217: Add a local task to preview a node through next.js site.

Open fiasco opened this issue 3 years ago • 9 comments

fiasco avatar Jun 22 '22 20:06 fiasco

@fiasco is attempting to deploy a commit to the Chapter Three Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jun 22 '22 20:06 vercel[bot]

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)

vercel[bot] avatar Jun 23 '22 07:06 vercel[bot]

@fiasco This looks great. I've also been doing some work on this. I'll send a PR with some updates soon.

shadcn avatar Jun 23 '22 07:06 shadcn

@fiasco How are you handling revisions in this case? Are you passing the revision id to the new route?

shadcn avatar Jun 23 '22 16:06 shadcn

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.

fiasco avatar Jun 27 '22 22:06 fiasco

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:

  1. 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.
image
  1. When I inspect the iframe, I can see its being passed a query parameter resourceVersion=rel:working-copy and when I open the iframe URL in a new window, it works as expected.
image

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?

fiasco avatar Jul 18 '22 01:07 fiasco

I confirmed this bug only exists in dev mode and works fine from npm run start

fiasco avatar Aug 01 '22 19:08 fiasco

@shadcn could you give this another review? From your perspective, what is holding this back from merge?

fiasco avatar Aug 04 '22 17:08 fiasco

@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.

shadcn avatar Aug 08 '22 17:08 shadcn