Skip to content

Commit a8d8767

Browse files
committed
Remove double useSelect
1 parent 0366817 commit a8d8767

File tree

1 file changed

+10
-12
lines changed
  • packages/edit-post/src/components/start-page-options

1 file changed

+10
-12
lines changed

packages/edit-post/src/components/start-page-options/index.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@ import { store as editPostStore } from '../../store';
1414
export default function StartPageOptions() {
1515
const [ isClosed, setIsClosed ] = useState( false );
1616
const { resetEditorBlocks } = useDispatch( editorStore );
17-
const postType = useSelect(
18-
( select ) => select( editorStore ).getCurrentPostType(),
19-
[]
20-
);
21-
const shouldEnableModal = useSelect( ( select ) => {
22-
const { isCleanNewPost } = select( editorStore );
17+
const { shouldOpenModal, postType } = useSelect( ( select ) => {
18+
const { isCleanNewPost, getCurrentPostType } = select( editorStore );
2319
const { isEditingTemplate, isFeatureActive } = select( editPostStore );
2420

25-
return (
26-
! isEditingTemplate() &&
27-
! isFeatureActive( 'welcomeGuide' ) &&
28-
isCleanNewPost()
29-
);
21+
return {
22+
shouldOpenModal:
23+
! isEditingTemplate() &&
24+
! isFeatureActive( 'welcomeGuide' ) &&
25+
isCleanNewPost(),
26+
postType: getCurrentPostType(),
27+
};
3028
}, [] );
3129

32-
if ( isClosed || ! shouldEnableModal ) {
30+
if ( isClosed || ! shouldOpenModal ) {
3331
return null;
3432
}
3533

0 commit comments

Comments
 (0)