diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx index 4b3a962ef9..f470eac26e 100644 --- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx +++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx @@ -157,6 +157,13 @@ function VariableItem({ } else { [value] = newOptionsData; } + } else if (variableData.multiSelect) { + const { selectedValue } = variableData; + allSelected = + newOptionsData.length > 0 && + Array.isArray(selectedValue) && + selectedValue.length === newOptionsData.length && + newOptionsData.every((option) => selectedValue.includes(option)); } if (variableData && variableData?.name && variableData?.id) { @@ -235,8 +242,9 @@ function VariableItem({ }, ); - const handleChange = (value: string | string[]): void => { - // if value is equal to selected value then return + const handleChange = (inputValue: string | string[]): void => { + const value = variableData.multiSelect && !inputValue ? [] : inputValue; + if ( value === variableData.selectedValue || (Array.isArray(value) &&