You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a collection with products on which versions and draft were both NOT enabled. After the collection had been filled through api, i realized this and enabled drafts and versions:
versions: {
drafts: true,
},
When doing this, the entire collection appears empty in the admin panel. When removing the config again, the docs re-appear.
When only adding versions: true all docs appear like normal.
To Reproduce
Create a collection without any versions or draft setting
add docs to this collection (in my case via rest api)
I tried manually adding a _status field with value published before enabling drafts. I thought maybe the docs don't show because this field is missing. Unfortunately, this does not solve the problem.
We should improve the docs and DX here. Changing a collection with existing data to have drafts will cause this exact behavior. This is not expected to work without manual data migration.
We have a few options here, but showing a warning and maybe linking to docs and a migration file would be a good start.
Saving all the docs again will add them to the versions collection, which is where draft enabled collections are queried from when draft:true (this is how the list view queries).
Activity
silveltman commentedon Oct 28, 2023
I tried manually adding a
_statusfield with valuepublishedbefore enabling drafts. I thought maybe the docs don't show because this field is missing. Unfortunately, this does not solve the problem.denolfe commentedon Oct 28, 2023
We should improve the docs and DX here. Changing a collection with existing data to have drafts will cause this exact behavior. This is not expected to work without manual data migration.
We have a few options here, but showing a warning and maybe linking to docs and a migration file would be a good start.
JarrodMFlesch commentedon Oct 28, 2023
Something like this would work for you, #434.
Saving all the docs again will add them to the versions collection, which is where draft enabled collections are queried from when draft:true (this is how the list view queries).
neslob commentedon Aug 7, 2024
this happened for me in 3.0.0-beta.74 when adding versions / drafts to my Posts collection.
The documentation did not give me a warning or I overlooked it. https://payloadcms.com/docs/beta/versions/overview.
But found this closed issue.
Here is my solution.
Server action.
Add to component.
And to the collection
Ran it and all posts got republished and are now visible again.
github-actions commentedon Sep 6, 2024
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.