Skip to content

Commit

Permalink
EPMRPP-80095 || Error when unchecking all defect types in filter (#4095)
Browse files Browse the repository at this point in the history
  • Loading branch information
iso9000t authored Nov 13, 2024
1 parent d3b1b48 commit b5127d6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/src/components/inputs/inputDropdown/inputDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@ export class InputDropdown extends Component {
const relatedSubOptions = this.props.options
.filter((item) => item.groupRef === groupId)
.map((item) => item.value);

if (this.isGroupOptionSelected(groupId)) {
this.props.onChange(
this.props.value.filter((item) => relatedSubOptions.indexOf(item) === -1),
this.props.value.filter(
(item) => item !== groupId && relatedSubOptions.indexOf(item) === -1,
),
);
} else {
this.props.onChange(
Expand All @@ -169,10 +172,10 @@ export class InputDropdown extends Component {
};

handleAllClick = () => {
if (this.props.value.length !== this.props.options.length) {
this.props.onChange(
this.props.options.filter((item) => !item.disabled).map((item) => item.value),
);
const filteredOptions = this.props.options.filter((item) => !item.disabled && !item.groupId);

if (this.props.value.length !== filteredOptions.length) {
this.props.onChange(filteredOptions.map((item) => item.value));
} else {
this.props.onChange([]);
}
Expand Down

0 comments on commit b5127d6

Please sign in to comment.