Skip to content

Commit

Permalink
Do not auto save post status changes (#62171)
Browse files Browse the repository at this point in the history
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
  • Loading branch information
4 people committed May 31, 2024
1 parent 7efd961 commit 61afbd5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( {
Expand Down

0 comments on commit 61afbd5

Please sign in to comment.