From d8fa4e68ff54c027c5d0cef9666e798265f94b60 Mon Sep 17 00:00:00 2001 From: Developer Date: Tue, 19 May 2026 10:34:00 +0530 Subject: [PATCH] fix: reuploading file on Save draft resets main doc _status to draft For an upload-enabled collection with drafts enabled, replacing a published file and saving as a draft incorrectly overwrites the main collection document's _status from 'published' to 'draft'. The bug was in collections/operations/utilities/update.ts where data._status = 'draft' was set unconditionally when isSavingDraft was true, even when updating an existing published document. Fix by only setting _status = 'draft' for new documents (when id is undefined). For existing documents, the main doc should remain published while a draft version is created. Closes #16633 --- packages/payload/src/collections/operations/utilities/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payload/src/collections/operations/utilities/update.ts b/packages/payload/src/collections/operations/utilities/update.ts index f604129ecf1..d48f9a569a0 100644 --- a/packages/payload/src/collections/operations/utilities/update.ts +++ b/packages/payload/src/collections/operations/utilities/update.ts @@ -121,7 +121,7 @@ export const updateDocument = async < !isSavingDraft, ) - if (isSavingDraft) { + if (isSavingDraft && !id) { data._status = 'draft' }