Skip to content

Commit 5e64940

Browse files
committed
feat: add a clear button to FilterPicker, Select, ComboBox * 2
1 parent a5b3208 commit 5e64940

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/components/fields/ComboBox/ComboBox.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -332,23 +332,11 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
332332
let clearValue = useEvent(() => {
333333
if (props.allowsCustomValue) {
334334
props.onInputChange?.('');
335-
// If state has a setInputValue method, use it as well
336-
if (
337-
'setInputValue' in state &&
338-
typeof state.setInputValue === 'function'
339-
) {
340-
state.setInputValue('');
341-
}
342-
} else {
343-
props.onSelectionChange?.(null);
344-
// If state has a setSelectedKey method, use it as well
345-
if (
346-
'setSelectedKey' in state &&
347-
typeof state.setSelectedKey === 'function'
348-
) {
349-
state.setSelectedKey(null);
350-
}
335+
state.setInputValue('');
351336
}
337+
props.onSelectionChange?.(null);
338+
state.setSelectedKey(null);
339+
352340
// Close the popup if it's open
353341
if (state.isOpen) {
354342
state.close();

0 commit comments

Comments
 (0)