diff --git a/packages/editor/src/components/post-actions/actions.js b/packages/editor/src/components/post-actions/actions.js index 1b6ff4fbe384b5..808134ea969a11 100644 --- a/packages/editor/src/components/post-actions/actions.js +++ b/packages/editor/src/components/post-actions/actions.js @@ -52,10 +52,11 @@ export function usePostActions( { postType, onActionPerformed, context } ) { }, [ registerPostTypeSchema, postType ] ); return useMemo( () => { - let actions = [ - ...defaultActions, - shouldShowSetAsHomepageAction ? setAsHomepageAction : [], - ]; + let actions = [ ...defaultActions ]; + if ( shouldShowSetAsHomepageAction ) { + actions.push( setAsHomepageAction ); + } + // Filter actions based on provided context. If not provided // all actions are returned. We'll have a single entry for getting the actions // and the consumer should provide the context to filter the actions, if needed.