From 17d6911160ebffb08db53fb576c0f39f244a86c8 Mon Sep 17 00:00:00 2001 From: iso9000t <119494473+iso9000t@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:20:44 +0400 Subject: [PATCH] EPMRPP-80095 || Error when unchecking all defect types in filter --- .../inputs/inputDropdown/inputDropdown.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/components/inputs/inputDropdown/inputDropdown.jsx b/app/src/components/inputs/inputDropdown/inputDropdown.jsx index 4a2ab0d4e9..cd4e9a221d 100644 --- a/app/src/components/inputs/inputDropdown/inputDropdown.jsx +++ b/app/src/components/inputs/inputDropdown/inputDropdown.jsx @@ -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( @@ -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([]); }