From 61afbd548db6695c0ea7aab6c210a0bf2dbbf3a5 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Fri, 31 May 2024 13:08:04 +0300 Subject: [PATCH] Do not auto save post status changes (#62171) Co-authored-by: ntsekouras Co-authored-by: Mamaduka Co-authored-by: jameskoster --- packages/core-data/src/actions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core-data/src/actions.js b/packages/core-data/src/actions.js index be4d12f0cb9ef6..36b0ba5f84c9d1 100644 --- a/packages/core-data/src/actions.js +++ b/packages/core-data/src/actions.js @@ -598,10 +598,14 @@ export const saveEntityRecord = return acc; }, { + // Do not update the `status` if we have edited it when auto saving. + // It's very important to let the user explicitly save this change, + // because it can lead to unexpected results. An example would be to + // have a draft post and change the status to publish. status: data.status === 'auto-draft' ? 'draft' - : data.status, + : undefined, } ); updatedRecord = await __unstableFetch( {