#18389·payload

Restoring a Draft version in the admin unpublishes the live document

Author: jimmi-joenssonCreated Sep 29, 2026Updated Sep 29, 2026
Labelsarea: uiarea: coreBug

Describe the Bug

On a collection with versions: { drafts: true }, restoring a Draft version from the admin version view unpublishes the live document.

The Restore button only offers "Restore as draft" when the viewed version is not a draft:

typescript
const canRestoreAsDraft = status !== 'draft' && collectionConfig?.versions?.drafts

For a Draft version the only option is "Restore this version", which sends POST /api/<collection>/versions/<id>?draft=false. restoreVersionOperation then calls db.updateOne on the main collection with the version's data, including _status: 'draft'. The published document is overwritten and the public page (queried without draft) disappears.

POST /api/<collection>/versions/<id>?draft=true restores the same Draft version safely (new draft version, main document untouched), but no admin button sends it for Draft versions.

Expected: restoring a Draft version creates a new draft and leaves the published document live, like "Restore as draft" does for Published versions.

Related observations:

  • setDraft(true) from "Restore as draft" is never reset. If the confirmation modal is cancelled, the next click on "Restore this version" still sends draft=true.
  • For globals, restoreVersionOperation in packages/payload/src/globals/operations/restoreVersion.ts always calls db.updateGlobal, so draft=true also overwrites the live global (it only forces _status: 'draft').

The fix we applied locally as a pnpm patch on @payloadcms/[email protected] (dist/views/Version/Restore/index.js): when the version is a Draft and the collection has drafts, the main button restores with draft=true and is labelled "Restore as draft"; the main button also resets draft on click.

javascript
const restoresAsDraftOnly = status === 'draft' && Boolean(collectionConfig?.versions?.drafts)
// Button
onClick: () => [setDraft(restoresAsDraftOnly), toggleModal(modalSlug)],
children: restoresAsDraftOnly ? t('version:restoreAsDraft') : t('version:restoreThisVersion'),

The same code is in packages/ui/src/views/Version/Restore/index.tsx on main.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/ui/src/views/Version/Restore/index.tsx

Reproduction Steps

  1. Collection with versions: { drafts: true }. Create a document and publish it.
  2. Save two drafts with different titles (Draft A, Draft B).
  3. Open Versions, select the Draft A version. Only "Restore this version" is offered.
  4. Restore it.
  5. The main document now has _status: 'draft'; payload.find({ collection, draft: false }) / the public page no longer returns the published content (404 on a frontend that only renders published documents).

With POST /api/<collection>/versions/<DraftA id>?draft=true instead, the published document stays live and the latest draft has Draft A's content.

Which area(s) are affected?

area: ui, area: core

Environment Info

Payload: 3.89.0 (@payloadcms/next, @payloadcms/ui, payload)
Next.js: 15.4.11
Node.js: 22
Database: @payloadcms/db-sqlite and @payloadcms/db-postgres