mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
fix(ui): check for duplicated values in AlertStore.filters.replaceFilter
This commit is contained in:
@@ -102,8 +102,15 @@ class AlertStore {
|
||||
replaceFilter(oldRaw, newRaw) {
|
||||
const index = this.values.findIndex(e => e.raw === oldRaw);
|
||||
if (index >= 0) {
|
||||
this.values[index] = newUnappliedFilter(newRaw);
|
||||
UpdateLocationSearch({ q: this.values.map(f => f.raw) });
|
||||
// first check if we would create a duplicated filter
|
||||
if (this.values.findIndex(e => e.raw === newRaw) >= 0) {
|
||||
// we already have newRaw, simply drop oldRaw
|
||||
this.removeFilter(oldRaw);
|
||||
} else {
|
||||
// no dups, continue with a swap
|
||||
this.values[index] = newUnappliedFilter(newRaw);
|
||||
UpdateLocationSearch({ q: this.values.map(f => f.raw) });
|
||||
}
|
||||
}
|
||||
},
|
||||
setFilters(raws) {
|
||||
|
||||
Reference in New Issue
Block a user