Skip to content

Commit

Permalink
Site editor: Check template resolution (#33527)
Browse files Browse the repository at this point in the history
Check template resolution before showing warning notice
  • Loading branch information
Petter Walbø Johnsgård authored and sarayourfriend committed Jul 23, 2021
1 parent 0404b55 commit f8d400f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function Editor( { initialSettings } ) {
templateType,
page,
template,
templateResolved,
isNavigationOpen,
} = useSelect( ( select ) => {
const {
Expand All @@ -67,6 +68,7 @@ function Editor( { initialSettings } ) {
getPage,
isNavigationOpened,
} = select( editSiteStore );
const { hasFinishedResolution, getEntityRecord } = select( coreStore );
const postType = getEditedPostType();
const postId = getEditedPostId();

Expand All @@ -81,12 +83,15 @@ function Editor( { initialSettings } ) {
templateType: postType,
page: getPage(),
template: postId
? select( coreStore ).getEntityRecord(
? getEntityRecord( 'postType', postType, postId )
: null,
templateResolved: postId
? hasFinishedResolution( 'getEntityRecord', [
'postType',
postType,
postId
)
: null,
postId,
] )
: false,
entityId: postId,
isNavigationOpen: isNavigationOpened(),
};
Expand Down Expand Up @@ -225,7 +230,8 @@ function Editor( { initialSettings } ) {
}
/>
) }
{ ! template &&
{ templateResolved &&
! template &&
settings?.siteUrl &&
entityId && (
<Notice
Expand Down

0 comments on commit f8d400f

Please sign in to comment.