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
{{ message }}
Repository navigation
Trashing a published document that has a pending draft replaces the live content with the draft #19449
Trashing a published post that has a pending draft replaces the published content with the draft content and sets _status to draft. Restoring it does not bring the published version back.
I know #15981 made trash start from the latest version so that draft-only documents do not lose data. I am not sure this case was meant to be covered too, so this may be a question more than a bug.
The collection has trash: true and versions.drafts. I use the same request the admin UI sends when you trash a document (PATCH with { deletedAt }, no draft flag):
Create and publish a post titled published-v1.
Save a draft titled draft-v2. The main document still shows published-v1.
Trash the post.
Restore it (deletedAt: null).
After step 3 the main document is draft-v2 with _status: draft. After step 4 it is still draft-v2 / draft. The published content is no longer live. A post without a pending draft is restored correctly as published.
Expected: restoring gives back the document as it was, published-v1 published, with draft-v2 still pending.
Version history still has the published-v1 version, so it can be restored by hand.
git clone https://github.com/volodymyrshk/payload-draft-repros && cd payload-draft-repros
npm install
npm run trash
It prints the main document and the latest version after each step. The collection is posts with trash: true and versions.drafts, using @payloadcms/db-sqlite. The script uses the Local API only. I have only run it on SQLite.
Which area(s) are affected?
area: core, db: sqlite
Environment Info
Payload: 3.93.0
@payloadcms/db-sqlite: 3.93.0
Node.js: v25.6.1
OS: macOS (Darwin)
Next.js: not used (Local API script)
I've opened a PR for this: #19537. Trashing a published document with a pending draft now keeps the published content on the main document, and restoring brings it back, while the pending draft stays the latest draft version. It includes a regression test in test/trash/int.spec.ts. Happy to adjust anything.
Activity
muhammad-wasif-code commentedon Nov 12, 2026
I've opened a PR for this: #19537. Trashing a published document with a pending draft now keeps the published content on the main document, and restoring brings it back, while the pending draft stays the latest draft version. It includes a regression test in
test/trash/int.spec.ts. Happy to adjust anything.