diff --git a/packages/editor/src/components/document-bar/index.js b/packages/editor/src/components/document-bar/index.js index 68a2edcf2e00b9..78dd676c7f79b8 100644 --- a/packages/editor/src/components/document-bar/index.js +++ b/packages/editor/src/components/document-bar/index.js @@ -52,8 +52,9 @@ const MotionButton = motion( Button ); export default function DocumentBar() { const { postType, - document, - isResolving, + documentTitle, + isNotFound, + isUnsyncedPattern, templateIcon, templateTitle, onNavigateToPreviousEntityRecord, @@ -76,13 +77,16 @@ export default function DocumentBar() { const _templateInfo = getTemplateInfo( _document ); return { postType: _postType, - document: _document, - isResolving: isResolvingSelector( - 'getEditedEntityRecord', - 'postType', - _postType, - _postId - ), + documentTitle: _document.title, + isNotFound: + ! _document && + ! isResolvingSelector( + 'getEditedEntityRecord', + 'postType', + _postType, + _postId + ), + isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced', templateIcon: unlock( select( editorStore ) ).getPostIcon( _postType, { @@ -98,12 +102,10 @@ export default function DocumentBar() { const { open: openCommandCenter } = useDispatch( commandsStore ); const isReducedMotion = useReducedMotion(); - const isNotFound = ! document && ! isResolving; const isTemplate = TEMPLATE_POST_TYPES.includes( postType ); const isGlobalEntity = GLOBAL_POST_TYPES.includes( postType ); const hasBackButton = !! onNavigateToPreviousEntityRecord; - const title = isTemplate ? templateTitle : document.title; - const isUnsyncedPattern = document?.wp_pattern_sync_status === 'unsynced'; + const title = isTemplate ? templateTitle : documentTitle; const mounted = useRef( false ); useEffect( () => {