-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Describe the bug
selectedFilters.filter((filter) => filter[0] === aggName && filter[1] === value) This step uses strict comparison between value and type.
In case the bucket contains Integer value (key), i.e. year, age, etc., upon bucket click, the checkbox doesn't appear visually checked (the comparison fails). On the other hand, the filter is applied, so the search parameters (and URL) gets updated. The problem lies only in the unset isSelected prop that gets passed down to the Checkbox SemanticUI component.
The same problem could potentially happen with other data types: boolean, etc.
I don't think that it's meant for the bucket containing key as integer (or boolean), to also contain bucket.key_as_string property, as seen here:
const keyField = bucket.key_as_string ? bucket.key_as_string : bucket.key;
const isSelected = this._isSelected(this.aggName, keyField, selectedFilters);
For example for years or age, or any other number coming from backend.
Expected behavior
Using value comparison only, the issue can be easily solved:
selectedFilters.filter((filter) => filter[0] == aggName && filter[1] == value)