Skip to content

Commit dbe1496

Browse files
authored
fix(app): clear VirtualMultiSelect search input on select/add (#2676)
## Why Previously, when a user typed a search value into the `VirtualMultiSelect` and then added it as a value, the typed text was left behind in the input. This diverges from the behavior of a non-virtualized Mantine `MultiSelect` with search, which clears the input after a value is selected. This has been requested by at least 3 independent users. ### Before https://github.com/user-attachments/assets/24f0dba2-63cc-4e12-b164-5a02356f9fa8 ### After https://github.com/user-attachments/assets/faa0b7a0-afa4-496e-81fb-9b9ba7692ba3 ## Testing This can be tested in the preview environment by creating a dashboard filter and searching for + selecting a value. Closes [HDX-4816](https://linear.app/clickhouse/issue/HDX-4816/clear-out-virtualmultiselect-input-when-clicking-enter-selecting-a)
1 parent 013784d commit dbe1496

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
fix: clear the VirtualMultiSelect search input after selecting a value

‎packages/app/src/components/VirtualMultiSelect/VirtualMultiSelect.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ export function VirtualMultiSelect({
6666
},
6767
});
6868

69-
const handleSelectValue = (val: string) =>
69+
const handleSelectValue = (val: string) => {
7070
onChange(
7171
values.includes(val) ? values.filter(v => v !== val) : [...values, val],
7272
);
73+
setSearch('');
74+
};
7375

7476
const handleRemoveValue = (val: string) =>
7577
onChange(values.filter(v => v !== val));

0 commit comments

Comments
 (0)