mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Fix commit filter logic for empty search strings
This commit is contained in:
2 files changed
+8
-23
No files matched your search
@@ -43,17 +43,9 @@ export default function useColumnSearch<T>(
|
||||
setSelectedKeys(values);
|
||||
tableState.setFilter(columnKey, values.length ? values : null);
|
||||
}}
|
||||
onSearch={value => {
|
||||
if (value) {
|
||||
close();
|
||||
} else {
|
||||
// antd fires onSearch with an empty value when the clear (X) is clicked
|
||||
// (before onChange); commit the cleared state instead of closing, which
|
||||
// would re-commit the still-live typed value.
|
||||
setSelectedKeys([]);
|
||||
tableState.setFilter(columnKey, null);
|
||||
tableState.commitFilter(columnKey, null);
|
||||
}
|
||||
onPressEnter={e => {
|
||||
close();
|
||||
tableState.commitFilter(columnKey);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user