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` (#68168)

Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: mcsf <[email protected]>
Co-authored-by: oandregal <[email protected]>
  • Loading branch information
4 people authored Dec 20, 2024
1 parent 048b9d3 commit d9f18e5
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

1 comment on commit d9f18e5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in d9f18e5.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12435344199
📝 Reported issues:

Please sign in to comment.