Skip to content

Commit

Permalink
Don't open the starter patterns modal while the preferences modal is …
Browse files Browse the repository at this point in the history
…still open
  • Loading branch information
glendaviesnz committed Nov 20, 2023
1 parent 719e319 commit 9354b0a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import { useSelect, useDispatch } from '@wordpress/data';
import { useAsyncList } from '@wordpress/compose';
import { store as editorStore } from '@wordpress/editor';
import { store as preferencesStore } from '@wordpress/preferences';
import { store as interfaceStore } from '@wordpress/interface';

/**
* Internal dependencies
*/
import { store as editPostStore } from '../../store';
import { PREFERENCES_MODAL_NAME } from '../preferences-modal';

export function useStartPatterns() {
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
Expand Down Expand Up @@ -97,11 +99,15 @@ export default function StartPageOptions() {
'core/edit-post',
'enableChoosePatternModal'
);
const preferencesModalActive = select( interfaceStore ).isModalActive(
PREFERENCES_MODAL_NAME
);
return (
! isEditingTemplate() &&
! isFeatureActive( 'welcomeGuide' ) &&
isCleanNewPost() &&
enableChoosePatternModal
enableChoosePatternModal &&
! preferencesModalActive
);
}, [] );

Expand Down

0 comments on commit 9354b0a

Please sign in to comment.