Skip to content

Commit

Permalink
Editor: Use edited entity for post actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed May 23, 2024
1 parent b284172 commit 247baee
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 247baee

Please sign in to comment.