Variables: Improve display when selecting variables with the same value (#40607)

* Variables: Allow selection of different variables with the same value

* Variables: Don't modify this key
This commit is contained in:
Ashley Harrison 2021-10-19 14:13:17 +01:00 committed by GitHub
parent 60b4e95d15
commit e48d77b1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 = [];
}