saveEditedEntityRecord does not always save the entity record, meaning that both saveEditedEntityRecord and saveEntityRecord need to be called in order to save an entity record successfully.
Taking a quick look at the saveEditedEntityRecord function, it does call saveEntityRecord, but there are some cases where I believe it's returning early unnecessarily, meaning saveEntityRecord needs to be specifically called. I think it's when recordId is undefined, which it will be if saving global site settings which do not require an ID.
Description
saveEditedEntityRecord
does not always save the entity record, meaning that bothsaveEditedEntityRecord
andsaveEntityRecord
need to be called in order to save an entity record successfully.Taking a quick look at the
saveEditedEntityRecord
function, it does callsaveEntityRecord
, but there are some cases where I believe it's returning early unnecessarily, meaningsaveEntityRecord
needs to be specifically called. I think it's whenrecordId
isundefined
, which it will be if saving global site settings which do not require an ID.This came up while working on https://github.com/WordPress/gutenberg/pull/65426/#discussion_r1850029321.
Step-by-step reproduction instructions
Try saving the global site settings via
saveEditedEntityRecord
:The site settings will not be saved. However, if you run
saveEntityRecord
immediately before it, the site settings will be saved successfully:Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.