File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -525,8 +525,9 @@ export const saveEntityRecord =
525525 if ( ! entityConfig ) {
526526 return ;
527527 }
528- const entityIdKey = entityConfig . key || DEFAULT_ENTITY_KEY ;
528+ const entityIdKey = entityConfig . key ?? DEFAULT_ENTITY_KEY ;
529529 const recordId = record [ entityIdKey ] ;
530+ const isNewRecord = ! ! entityIdKey && ! recordId ;
530531
531532 const lock = await dispatch . __unstableAcquireStoreLock (
532533 STORE_NAME ,
@@ -580,11 +581,10 @@ export const saveEntityRecord =
580581 }
581582 try {
582583 const path = `${ baseURL } ${ recordId ? '/' + recordId : '' } ` ;
583- const persistedRecord = select . getRawEntityRecord (
584- kind ,
585- name ,
586- recordId
587- ) ;
584+ // Skip the raw values check when creating a new record; they don't exist yet.
585+ const persistedRecord = ! isNewRecord
586+ ? select . getRawEntityRecord ( kind , name , recordId )
587+ : { } ;
588588
589589 if ( isAutosave ) {
590590 // Most of this autosave logic is very specific to posts.
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export const rootEntitiesConfig = [
3636 {
3737 label : __ ( 'Base' ) ,
3838 kind : 'root' ,
39+ key : false ,
3940 name : '__unstableBase' ,
4041 baseURL : '/' ,
4142 baseURLParams : {
@@ -381,6 +382,7 @@ async function loadSiteEntity() {
381382 label : __ ( 'Site' ) ,
382383 name : 'site' ,
383384 kind : 'root' ,
385+ key : false ,
384386 baseURL : '/wp/v2/settings' ,
385387 meta : { } ,
386388 } ;
You can’t perform that action at this time.
0 commit comments