fix: fixed handling of how and when to set ALL option (#7244)

This commit is contained in:
SagarRajput-7 2025-03-10 14:18:55 +05:30 committed by GitHub
parent 1f33928bf9
commit e92e0b6e29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) &&