Skip to content

Commit

Permalink
DataViews: Don't render actions dropdown when all eligible ones are `…
Browse files Browse the repository at this point in the history
…primary`
  • Loading branch information
ntsekouras committed Dec 20, 2024
1 parent 910c38f commit e5ad8ea
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,6 @@ export function ActionsMenuGroup< Item >( {
);
}

function hasOnlyOneActionAndIsPrimary< Item >(
primaryActions: Action< Item >[],
actions: Action< Item >[]
) {
return primaryActions.length === 1 && actions.length === 1;
}

export default function ItemActions< Item >( {
item,
actions,
Expand Down Expand Up @@ -184,7 +177,8 @@ export default function ItemActions< Item >( {
);
}

if ( hasOnlyOneActionAndIsPrimary( primaryActions, actions ) ) {
// If all actions are primary, there is no need to render the dropdown.
if ( primaryActions.length === eligibleActions.length ) {
return (
<PrimaryActions
item={ item }
Expand Down

0 comments on commit e5ad8ea

Please sign in to comment.