diff --git a/packages/edit-site/src/components/editor/use-editor-title.js b/packages/edit-site/src/components/editor/use-editor-title.js index d9d2b720c0bc3..91a56f9fbd492 100644 --- a/packages/edit-site/src/components/editor/use-editor-title.js +++ b/packages/edit-site/src/components/editor/use-editor-title.js @@ -28,13 +28,14 @@ function useEditorTitle( postType, postId ) { postId ); - const templateAreas = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_part_areas || []; - - const templateTypes = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_types || []; + const { + default_template_part_areas: templateAreas = [], + default_template_types: templateTypes = [], + } = + select( coreStore ).getEntityRecord( + 'root', + '__unstableBase' + ) ?? {}; const templateInfo = getTemplateInfo( { template: _record, diff --git a/packages/editor/src/components/document-bar/index.js b/packages/editor/src/components/document-bar/index.js index a1d1861a3d2f5..d081e6b83d6ac 100644 --- a/packages/editor/src/components/document-bar/index.js +++ b/packages/editor/src/components/document-bar/index.js @@ -82,13 +82,13 @@ export default function DocumentBar( props ) { _postId ); - const templateAreas = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_part_areas || []; + const { + default_template_part_areas: templateAreas = [], + default_template_types: templateTypes = [], + } = + select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) ?? + {}; - const templateTypes = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_types || []; const _templateInfo = getTemplateInfo( { templateAreas, templateTypes, diff --git a/packages/editor/src/components/entities-saved-states/entity-record-item.js b/packages/editor/src/components/entities-saved-states/entity-record-item.js index 79e200dede6fe..ac1492f282a04 100644 --- a/packages/editor/src/components/entities-saved-states/entity-record-item.js +++ b/packages/editor/src/components/entities-saved-states/entity-record-item.js @@ -35,13 +35,14 @@ export default function EntityRecordItem( { record, checked, onChange } ) { key ); - const templateAreas = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_part_areas || []; - - const templateTypes = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_types || []; + const { + default_template_part_areas: templateAreas = [], + default_template_types: templateTypes = [], + } = + select( coreStore ).getEntityRecord( + 'root', + '__unstableBase' + ) ?? {}; return { entityRecordTitle: getTemplateInfo( { diff --git a/packages/editor/src/components/post-card-panel/index.js b/packages/editor/src/components/post-card-panel/index.js index 51d156d1bd7f8..78cc721eca57f 100644 --- a/packages/editor/src/components/post-card-panel/index.js +++ b/packages/editor/src/components/post-card-panel/index.js @@ -38,13 +38,14 @@ export default function PostCardPanel( { postId ); - const templateAreas = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_part_areas || []; - - const templateTypes = - select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) - ?.default_template_types || []; + const { + default_template_part_areas: templateAreas = [], + default_template_types: templateTypes = [], + } = + select( coreStore ).getEntityRecord( + 'root', + '__unstableBase' + ) ?? {}; const _templateInfo = [ TEMPLATE_POST_TYPE,