diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d8e50cd..6fca5056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - Fixed `IN` operator escaping the entire string (specifically with `Nullable(String)`), also added `FixedString(N)` (#830) +- Fixed query builder filter editor on alert rules page (#828) ## 4.0.7 diff --git a/src/components/queryBuilder/FilterEditor.test.tsx b/src/components/queryBuilder/FilterEditor.test.tsx index 1f32f4f5..78f30510 100644 --- a/src/components/queryBuilder/FilterEditor.test.tsx +++ b/src/components/queryBuilder/FilterEditor.test.tsx @@ -192,6 +192,28 @@ describe('FilterEditor', () => { // type key into the mapKey input await userEvent.type(result!.getAllByRole('combobox')[1], 'http.status_code'); await userEvent.keyboard('{Enter}'); + + result.rerender( + {}} + datasource={mockDatasource} + database='' + table='' + /> + ); + // type value into the input await userEvent.type(result!.getByTestId('query-builder-filters-single-string-value-input'), '200'); result!.getByTestId('query-builder-filters-single-string-value-input').blur(); diff --git a/src/components/queryBuilder/FilterEditor.tsx b/src/components/queryBuilder/FilterEditor.tsx index 4a732cc5..bb3a6886 100644 --- a/src/components/queryBuilder/FilterEditor.tsx +++ b/src/components/queryBuilder/FilterEditor.tsx @@ -328,12 +328,12 @@ export const FilterEditor = (props: { onFilterChange(index, newFilter); }; const onFilterMapKeyChange = (mapKey: string) => { - const newFilter: Filter = filter; + const newFilter: Filter = { ...filter }; newFilter.mapKey = mapKey; onFilterChange(index, newFilter); }; const onFilterOperatorChange = (operator: FilterOperator) => { - let newFilter: Filter = filter; + const newFilter: Filter = { ...filter }; newFilter.operator = operator; if (utils.isMultiFilter(newFilter)) { if (!Array.isArray(newFilter.value)) { @@ -343,7 +343,7 @@ export const FilterEditor = (props: { onFilterChange(index, newFilter); }; const onFilterConditionChange = (condition: 'AND' | 'OR') => { - let newFilter: Filter = filter; + const newFilter: Filter = { ...filter }; newFilter.condition = condition; onFilterChange(index, newFilter); };