diff --git a/public/app/features/variables/pickers/OptionsPicker/reducer.ts b/public/app/features/variables/pickers/OptionsPicker/reducer.ts index cece7d60714..4f70e2d3fa6 100644 --- a/public/app/features/variables/pickers/OptionsPicker/reducer.ts +++ b/public/app/features/variables/pickers/OptionsPicker/reducer.ts @@ -138,7 +138,7 @@ const optionsPickerSlice = createSlice({ const { multi, selectedValues } = state; if (option) { - const selected = !selectedValues.find((o) => o.value === option.value); + const selected = !selectedValues.find((o) => o.value === option.value && o.text === option.text); if (option.value === ALL_VARIABLE_VALUE || !multi || clearOthers) { if (selected || forceSelect) { @@ -153,7 +153,7 @@ const optionsPickerSlice = createSlice({ return applyStateChanges(state, updateDefaultSelection, updateAllSelection, updateOptions); } - state.selectedValues = selectedValues.filter((o) => o.value !== option.value); + state.selectedValues = selectedValues.filter((o) => o.value !== option.value && o.text !== option.text); } else { state.selectedValues = []; }