Skip to content

Commit

Permalink
Check that there's an actual template.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Oct 30, 2024
1 parent f808b34 commit 553af4d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/editor/src/components/preview-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
isViewable,
showIconLabels,
isTemplateHidden,
templateId,
} = useSelect( ( select ) => {
const { getDeviceType, getCurrentPostType } = select( editorStore );
const { getDeviceType, getCurrentPostType, getCurrentTemplateId } =
select( editorStore );
const { getRenderingMode } = unlock( select( editorStore ) );
const { getEntityRecord, getPostType } = select( coreStore );
const { get } = select( preferencesStore );
Expand All @@ -51,6 +53,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
isViewable: getPostType( _currentPostType )?.viewable ?? false,
showIconLabels: get( 'core', 'showIconLabels' ),
isTemplateHidden: getRenderingMode() === 'post-only',
templateId: getCurrentTemplateId(),
};
}, [] );
const { setDeviceType, setRenderingMode } = useDispatch( editorStore );
Expand Down Expand Up @@ -150,7 +153,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
</MenuItem>
</MenuGroup>
) }
{ ! isTemplate && (
{ ! isTemplate && !! templateId && (
<MenuGroup>
<MenuItem
icon={ ! isTemplateHidden ? check : undefined }
Expand Down

0 comments on commit 553af4d

Please sign in to comment.