diff --git a/src/components/queryBuilder/Filters.tsx b/src/components/queryBuilder/Filters.tsx
index 7d48009c..e09aa114 100644
--- a/src/components/queryBuilder/Filters.tsx
+++ b/src/components/queryBuilder/Filters.tsx
@@ -64,14 +64,12 @@ const FilterValueNumberItem = (props: { value: number; onChange: (value: number)
};
const FilterValueSingleStringItem = (props: { value: string; onChange: (value: string) => void }) => {
- const [value, setValue] = useState(props.value || '');
return (
setValue(e.currentTarget.value)}
- onBlur={() => props.onChange(value)}
+ defaultValue={props.value}
+ onBlur={(e) => props.onChange(e.currentTarget.value)}
/>
);
@@ -142,7 +140,15 @@ export const FilterValueEditor = (props: {
);
}
- return ;
+
+ return (
+
+ );
} else if (utils.isMultiFilter(filter)) {
const onMultiFilterValueChange = (value: string[]) => {
onFilterChange({ ...filter, value });
diff --git a/src/components/queryBuilder/QueryBuilder.test.tsx b/src/components/queryBuilder/QueryBuilder.test.tsx
index 52c5bdcc..5206a9da 100644
--- a/src/components/queryBuilder/QueryBuilder.test.tsx
+++ b/src/components/queryBuilder/QueryBuilder.test.tsx
@@ -25,6 +25,7 @@ describe('QueryBuilder', () => {
database: 'db',
table: 'foo',
fields: [],
+ filters: [],
}}
onBuilderOptionsChange={() => {}}
datasource={mockDs}