appbaseio / appbaseio/reactivesearch
Do not apply pristine range filters
- Dominant language
- JavaScript
- Stars
- 4.9k
- Forks
- 478
- PR merge metrics
- No merged PRs in 30d
Description
**Affected Projects**
React
**Library Version:** x.y.z
3.0.0-rc.20
**Describe the bug**
When filtering sparse data (i.e., when some of the attributes can be present, but may not be), you want filter components to only be applied when the user explicitly sets them.
For example: I work on a search app that filters by some date field, but that date field is only present in 40% of the documents. When I render the `RangeSlider` component, only items are shown that contain some value for the `dataField` attribute. This means that only documents are shown that have that specific date field.
This happens, because the `RangeSlider` applies a filter to the query with the `range` `start` and `end` values.
Ideally, this filter is only applied after the user interacts with the component. This could be fixed by adding a `pristine` state to `RangeSlider` and others, and only applies the filter when its value is false.
Perhaps this could be set as an optional prop, e.g. `ignoreUntouched`.
Contributor guide
Assessment
This issue has not been assessed yet.