Skip to content

Commit

Permalink
chore: shouldHideMenuItem works with less than 3 row actions (#2967)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
matthewgallo and kodiakhq[bot] authored May 9, 2023
1 parent 7b07c65 commit 2745913
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ const useActionsColumn = (hooks) => {
style={{ display: 'flex' }}
>
{rowActions.map((action, index) => {
const { id, itemText, onClick, icon, ...rest } = action;
const {
id,
itemText,
onClick,
icon,
shouldHideMenuItem,
...rest
} = action;
const hidden =
typeof shouldHideMenuItem === 'function' &&
shouldHideMenuItem(row);
if (hidden) {
return null;
}
const selectedRowId = selectedFlatRows?.filter((item) =>
item.id === row.id ? item.id : null
);
Expand Down

0 comments on commit 2745913

Please sign in to comment.