payload icon indicating copy to clipboard operation
payload copied to clipboard

Number id and versions produce incorrect result for collection list

Open GeorgeHulpoi opened this issue 1 year ago • 2 comments

Link to reproduction

https://github.com/GeorgeHulpoi/payload-number-id-versions-bug

Describe the Bug

When using a number ID, in the collection list, appears also the versions: image image

To Reproduce

  1. Create a post (id: 1, title: "Title")
  2. Edit that post (title: "Title Edited")

Now you will see 2 posts in collection list.

Payload Version

2.9.0

Adapters and Plugins

MongoDB

GeorgeHulpoi avatar Feb 01 '24 08:02 GeorgeHulpoi

Can confirm, this makes versions unusable in production for custom IDs. I will have a look to see if there is a fix.

apetrisor avatar Mar 18 '24 14:03 apetrisor

Looked at the source code, it is like this by design, it is not a bug. However, it happens only when you have drafts on, not just plain versions. It also happens to all other collections, not just Custom ID ones.

You can overcome this by using a filter (e.g. status = "published") but this is not ideal and the UX is not great. Imagine a team of editors working on thousands (or hundreds of thousands) of pieces of content.

Kinda weird situation to solve as when creating a new item, if you don't publish it, then you would not be able to find it anymore if we don't display drafts in the collection view. A solution would be to only display drafts when there is no published version.

I guess some people find the current design ok, as it is probably fine for small content sites, but what if we had a feature where we could specify via the collection config how drafts are handled?

drafts: {
  show: 'all', // default
  show: 'latest', // only show latest draft
  hideIfPublished: true // do not show drafts if there is a published version
}

apetrisor avatar Mar 18 '24 15:03 apetrisor

This issue was automatically closed due to lack of activity. If this issue is still relevant against the latest codebase, please create a new issue.

github-actions[bot] avatar Dec 06 '24 15:12 github-actions[bot]

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

github-actions[bot] avatar Dec 09 '24 04:12 github-actions[bot]