feat(search): enhance filter value handling

- Added `checkFilterValue` function to validate and update filter values
  in `SearchStoreLive`.
- Updated `FilterItem` to handle undefined `value` gracefully by providing
  a default empty array.

These changes improve robustness in filter value processing.
This commit is contained in:
Shekar Siri 2025-04-11 14:34:52 +02:00
parent 1f9bc5520a
commit 00c57348fd
2 changed files with 2 additions and 1 deletions

View file

@ -220,6 +220,7 @@ class SearchStoreLive {
updateFilter = (index: number, search: Partial<IFilter>) => {
const newFilters = this.instance.filters.map((_filter: any, i: any) => {
if (i === index) {
search.value = checkFilterValue(search.value);
return search;
}
return _filter;

View file

@ -157,7 +157,7 @@ export default class FilterItem {
const json = {
type: isMetadata ? FilterKey.METADATA : this.key,
isEvent: Boolean(this.isEvent),
value: this.value.map((i: any) => (i ? i.toString() : '')),
value: this.value?.map((i: any) => (i ? i.toString() : '')) || [],
operator: this.operator,
source: isMetadata ? this.key.replace(/^_/, '') : this.source,
sourceOperator: this.sourceOperator,