Skip to content

Commit

Permalink
Add post Id back
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Dec 20, 2024
1 parent 0c888af commit 36a302d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions packages/editor/src/components/start-page-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@ import { store as interfaceStore } from '@wordpress/interface';
import { store as editorStore } from '../../store';

export default function StartPageOptions() {
const shouldEnable = useSelect( ( select ) => {
const { isEditedPostDirty, isEditedPostEmpty, getCurrentPostType } =
select( editorStore );
const { postId, shouldEnable } = useSelect( ( select ) => {
const {
isEditedPostDirty,
isEditedPostEmpty,
getCurrentPostId,
getCurrentPostType,
} = select( editorStore );
const preferencesModalActive =
select( interfaceStore ).isModalActive( 'editor/preferences' );
const choosePatternModalEnabled = select( preferencesStore ).get(
'core',
'enableChoosePatternModal'
);
return (
choosePatternModalEnabled &&
! preferencesModalActive &&
! isEditedPostDirty() &&
isEditedPostEmpty() &&
'page' === getCurrentPostType()
);
return {
postId: getCurrentPostId(),
shouldEnable:
choosePatternModalEnabled &&
! preferencesModalActive &&
! isEditedPostDirty() &&
isEditedPostEmpty() &&
'page' === getCurrentPostType(),
};
}, [] );
const { setIsInserterOpened } = useDispatch( editorStore );

Expand All @@ -38,7 +44,7 @@ export default function StartPageOptions() {
category: 'core/starter-content',
} );
}
}, [ shouldEnable, setIsInserterOpened ] );
}, [ postId, shouldEnable, setIsInserterOpened ] );

return null;
}

0 comments on commit 36a302d

Please sign in to comment.