Skip to content

Commit

Permalink
fix(j-s): select all when only invalid files are in list
Browse files Browse the repository at this point in the history
  • Loading branch information
thorhildurt committed Jan 17, 2025
1 parent 07ca20f commit 3198fc9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const SelectableList: FC<Props> = (props) => {
setIsHandlingCTA(false)
}

const validSelectableItems = selectableItems.filter((item) => !item.invalid)
return (
<>
<Box
Expand All @@ -118,9 +119,8 @@ const SelectableList: FC<Props> = (props) => {
name="select-all"
label={formatMessage(strings.selectAllLabel)}
checked={
selectableItems.length > 0 &&
// check if all valid selectable items are checked
selectableItems
validSelectableItems.length > 0 &&
validSelectableItems
.filter((item) => !item.invalid)
.every((item) => item.checked)
}
Expand All @@ -132,7 +132,7 @@ const SelectableList: FC<Props> = (props) => {
})),
)
}
disabled={isHandlingCTA || selectableItems.length === 0}
disabled={isHandlingCTA || validSelectableItems.length === 0}
strong
/>
</Box>
Expand Down

0 comments on commit 3198fc9

Please sign in to comment.