diff --git a/frontend/app/components/shared/Filters/FilterValue/FilterValue.tsx b/frontend/app/components/shared/Filters/FilterValue/FilterValue.tsx index 4292a834b..fb5c5e530 100644 --- a/frontend/app/components/shared/Filters/FilterValue/FilterValue.tsx +++ b/frontend/app/components/shared/Filters/FilterValue/FilterValue.tsx @@ -15,17 +15,20 @@ function FilterValue(props: Props) { const lastIndex = filter.value.length - 1; const onAddValue = () => { - const newValues = filter.value.concat("") - try { - props.onUpdate({ ...filter.toData(), value: newValues }) - } catch (e) { - props.onUpdate({ ...filter, value: newValues }) - } + const newValue = filter.value.concat(''); + props.onUpdate({ ...filter, value: newValue }); + + // const newValues = filter.value.concat("") + // try { + // props.onUpdate({ ...filter.toData(), value: newValues }) + // } catch (e) { + // props.onUpdate({ ...filter, value: newValues }) + // } } const onRemoveValue = (valueIndex) => { - const newValues = filter.value.filter((_, _index) => _index !== valueIndex) - props.onUpdate({ ...filter, value: newValues }) + const newValue = filter.value.filter((_, index) => index !== valueIndex); + props.onUpdate({ ...filter, value: newValue }); } const onChange = (e, item, valueIndex) => { @@ -45,13 +48,11 @@ function FilterValue(props: Props) { } const handleBlur = (e) => { - // const { filter, onChange } = props; if (filter.type === FilterType.DURATION) { const { maxDuration, minDuration, key } = filter; if (maxDuration || minDuration) return; if (maxDuration !== durationValues.maxDuration || minDuration !== durationValues.minDuration) { - // onChange(e, { name: 'value', value: [this.state.minDuration, this.state.maxDuration] }); props.onUpdate({ ...filter, value: [durationValues.minDuration, durationValues.maxDuration] }); } } diff --git a/frontend/app/duck/customMetrics.js b/frontend/app/duck/customMetrics.js index 91ace5b42..c50d72d68 100644 --- a/frontend/app/duck/customMetrics.js +++ b/frontend/app/duck/customMetrics.js @@ -44,7 +44,7 @@ const defaultInstance = CustomMetric({ series: List([ { name: 'Series 1', - filter: new Filter({ filters: [], eventsOrder: 'and' }), + filter: new Filter({ filters: List(), eventsOrder: 'and' }), }, ]) }) diff --git a/frontend/app/types/filter/filter.js b/frontend/app/types/filter/filter.js index b8093d5cb..a98326314 100644 --- a/frontend/app/types/filter/filter.js +++ b/frontend/app/types/filter/filter.js @@ -95,7 +95,7 @@ export default Record({ startDate, endDate, events: List(events).map(Event), - filters: List(filters).map(NewFilter), + filters: List(filters).map(i => NewFilter(i).toData()), custom: Map(custom), } }