payload icon indicating copy to clipboard operation
payload copied to clipboard

[Unresolved] Upgrading to beta 108/109 causes duplicate entries when editing and drafts not working as expected

Open Collexi-Dev opened this issue 2 years ago • 7 comments

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.13.1
  npm: 10.5.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.0.0-beta.109
  next: 15.0.0-canary.160
  @payloadcms/db-mongodb: 3.0.0-beta.109
  @payloadcms/email-nodemailer: 3.0.0-beta.109
  @payloadcms/graphql: 3.0.0-beta.109
  @payloadcms/live-preview: 3.0.0-beta.109
  @payloadcms/live-preview-react: 3.0.0-beta.109
  @payloadcms/next/utilities: 3.0.0-beta.109
  @payloadcms/plugin-redirects: 3.0.0-beta.109
  @payloadcms/plugin-seo: 3.0.0-beta.109
  @payloadcms/richtext-lexical: 3.0.0-beta.109
  @payloadcms/translations: 3.0.0-beta.109
  @payloadcms/ui/shared: 3.0.0-beta.109
  react: 19.0.0-rc-5dcb0097-20240918
  react-dom: 19.0.0-rc-5dcb0097-20240918
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:41 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14

Describe the Bug

Not sure what the workflow is when a previous issue got closed but is unresolved, so creating this issue for visibility.

Original bug is described here: https://github.com/payloadcms/payload/issues/8430

I am using mongo in my Payload setup. I have a pretty basic Pages collection and had a few page entries. After updating from beta v107 to v108, when editing a pre-existing page a duplicate entry for the same ID is shown which both link to the same entry:

image Some observations:

Draft data is correctly saved, Publishing changes works and are shown as expected, Latest draft is not shown in preview but it instead shows a different fixed previous version, When creating a new entry in v108 no issues are observed.

The issue persists after updating to v109 as mentioned here: https://github.com/payloadcms/payload/issues/8430#issuecomment-2378452861

I had 1 old entry left created with v107, just updated from v108 to v109 and edited the page but it seems the issue still persists and I now have 3 duplicates:

image

Reproduction Steps

  1. Init project on beta.107
  2. Create and publish pages
  3. Update to beta.108
  4. Edit a previously published page => duplicate entry
  5. Update to beta.109
  6. Edit a (different) previously published page => triple entry

Adapters and Plugins

No response

Collexi-Dev avatar Sep 27 '24 08:09 Collexi-Dev

I'm experiencing the same issue across all my projects; re-saving the duplicated entities, as mentioned in #8430, did not resolve the problem.

timothylp avatar Sep 29 '24 10:09 timothylp

Facing the same issue It has to do something with the application layer. The duplicates are not in the DB, they happen when it queries the DB and populates the data.

sourabpramanik avatar Sep 30 '24 03:09 sourabpramanik

Until they fix the underlying issue. The way that I've fixed it was to find all versions where the parent field was of $type: string and replace them with the ObjectId version instead.

Then I went into the admin UI and published all the pages with a duplicate page and that seems to have cleared it all up for me

stofolus avatar Sep 30 '24 12:09 stofolus

Until they fix the underlying issue. The way that I've fixed it was to find all versions where the parent field was of $type: string and replace them with the ObjectId version instead.

Then I went into the admin UI and published all the pages with a duplicate page and that seems to have cleared it all up for me

In my case the parent is null in db

sourabpramanik avatar Sep 30 '24 15:09 sourabpramanik

🚀 This is included in version v3.0.0-beta.110

github-actions[bot] avatar Sep 30 '24 17:09 github-actions[bot]

Confirmed all good now, thanks 👍

Collexi-Dev avatar Oct 01 '24 06:10 Collexi-Dev

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

github-actions[bot] avatar Oct 03 '24 04:10 github-actions[bot]