From a4990d0fec1ceb3ab3d7d3e92b027ea404226c84 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 11 Apr 2025 14:34:52 +0200 Subject: [PATCH] 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. --- frontend/app/mstore/searchStoreLive.ts | 1 + frontend/app/mstore/types/filterItem.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/app/mstore/searchStoreLive.ts b/frontend/app/mstore/searchStoreLive.ts index 3d53db791..483039ca8 100644 --- a/frontend/app/mstore/searchStoreLive.ts +++ b/frontend/app/mstore/searchStoreLive.ts @@ -220,6 +220,7 @@ class SearchStoreLive { updateFilter = (index: number, search: Partial) => { const newFilters = this.instance.filters.map((_filter: any, i: any) => { if (i === index) { + search.value = checkFilterValue(search.value); return search; } return _filter; diff --git a/frontend/app/mstore/types/filterItem.ts b/frontend/app/mstore/types/filterItem.ts index d53122d99..f8785035d 100644 --- a/frontend/app/mstore/types/filterItem.ts +++ b/frontend/app/mstore/types/filterItem.ts @@ -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,