payload icon indicating copy to clipboard operation
payload copied to clipboard

Version collection publish/unpublish changes are not directly reflected in the UI

Open juliarn opened this issue 1 year ago • 5 comments

Describe the Bug.

When publishing or unpublishing a document in a version collection with drafts enabled, the UI does not directly show the status and data change, a manual reload is required. This is a quite relevant problem because it prevents interaction with the document on its most recent state, for example publishing directly after unpublishing is not possible without manually reloading the page.

Status bar before unpublishing (correct state): Image

Status bar after unpublishing (outdated state): Image

Status bar after a manual reload of the page (correct state): Image

This also applies to the data itself, not just the published status. When using a Hook to generate data on publish (collection-level beforeChange Hook), the generated data is also only visible after manually reloading the page. Another case where this is impeding interaction is when validation fails on publish. After doing this, the UI displays the document as published and thus disables the publish button. Like before, the correct state is shown again after reloading the page manually.

Reproduction Steps

This issue was produced with Payload running with the Next Dev Server.

  1. Create a collection with the following version configuration:
 versions: {
    drafts: {
      autosave: true,
      validate: false,
    },
  },
  1. Create a document of the collection and try to publish and unpublish it.

The collection I tested with also contained a Hook to generate data for a field, validations on some fields and access control.

Environment Info

Binaries:
  Node: 23.1.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.14.2
Relevant Packages:
  payload: 3.1.1
  next: 15.0.0
  @payloadcms/db-postgres: 3.1.1
  @payloadcms/graphql: 3.1.1
  @payloadcms/next/utilities: 3.1.1
  @payloadcms/richtext-lexical: 3.1.1
  @payloadcms/translations: 3.1.1
  @payloadcms/ui/shared: 3.1.1
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:00:32 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

juliarn avatar Nov 26 '24 11:11 juliarn

Looks like a similar issue is happening in https://github.com/payloadcms/payload/issues/9423

rilrom avatar Nov 26 '24 11:11 rilrom

Looks like a similar issue is happening in #9423

I thought this might be the same issue, but my issue still persists with 3.2.2 unfortunately.

juliarn avatar Nov 29 '24 19:11 juliarn

+1 on this we are facing the same issue on our end as mentioned by the OP we are on payload 3.2.1. Any updates on when this is going to be picked up.

chinmay-mehta avatar Dec 11 '24 11:12 chinmay-mehta

Happens with Payload 3.6.0 too. Only unpublish does not update the UI in my case. Video is attached.

https://github.com/user-attachments/assets/4b79476f-71ee-4964-9e24-38c4b5d7c8e3

cbratschi avatar Dec 12 '24 17:12 cbratschi

Yes, still bug in payload 3.6.0. Unpublish doesn't update Draft UI, need to refresh browser

lctone avatar Dec 13 '24 13:12 lctone

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Jan 10 '25 04:01 github-actions[bot]

🚀 This is included in version v3.16.0

github-actions[bot] avatar Jan 10 '25 19:01 github-actions[bot]