From 73afa3979a2b7bafd5e351fdcb9901c28d16ceb7 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 23 May 2024 13:02:27 +0300 Subject: [PATCH] Editor: Use edited entity for post actions (#61892) Co-authored-by: ntsekouras Co-authored-by: youknowriad Co-authored-by: jorgefilipecosta Co-authored-by: annezazu --- .../editor/src/components/post-actions/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/post-actions/index.js b/packages/editor/src/components/post-actions/index.js index 2a4fe03e90d6e..139762bf126a9 100644 --- a/packages/editor/src/components/post-actions/index.js +++ b/packages/editor/src/components/post-actions/index.js @@ -10,6 +10,7 @@ import { Modal, } from '@wordpress/components'; import { moreVertical } from '@wordpress/icons'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -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 );