Skip to content

Commit

Permalink
Editor: Use edited entity for post actions (WordPress#61892)
Browse files Browse the repository at this point in the history
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
  • Loading branch information
5 people authored and patil-vipul committed Jun 17, 2024
1 parent 323c6d0 commit 73afa39
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/editor/src/components/post-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Modal,
} from '@wordpress/components';
import { moreVertical } from '@wordpress/icons';
import { store as coreStore } from '@wordpress/core-data';

/**
* Internal dependencies
Expand All @@ -29,10 +30,16 @@ const {
export default function PostActions( { onActionPerformed, buttonProps } ) {
const [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );
const { item, postType } = useSelect( ( select ) => {
const { getCurrentPostType, getCurrentPost } = select( editorStore );
const { getCurrentPostType, getCurrentPostId } = select( editorStore );
const { getEditedEntityRecord } = select( coreStore );
const _postType = getCurrentPostType();
return {
item: getCurrentPost(),
postType: getCurrentPostType(),
item: getEditedEntityRecord(
'postType',
_postType,
getCurrentPostId()
),
postType: _postType,
};
}, [] );
const allActions = usePostActions( postType, onActionPerformed );
Expand Down

0 comments on commit 73afa39

Please sign in to comment.