mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Fix clearing a live-but-uncommitted search re-committing the old value
commitFilter now reads the live overrides from a ref that setFilter updates synchronously, so committing within the same event that changed a filter no longer sees a stale render closure. antd's Input.Search fires onSearch (before onChange) when the clear button is clicked, so onSearch now commits the cleared state instead of closing the dropdown, which had re-committed the still-live typed value. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2898fdf5d3
commit
40407e52d6
3 files changed
+29
-12
No files matched your search
@@ -155,9 +155,15 @@ export function useUserFilter(
|
||||
placeholder="Search username"
|
||||
value={filter.search}
|
||||
allowClear
|
||||
onSearch={() => close()}
|
||||
onSearch={value => {
|
||||
if (value) {
|
||||
close();
|
||||
} else {
|
||||
// Clear (X) fires onSearch with an empty value before onChange.
|
||||
update({ search: undefined }, true);
|
||||
}
|
||||
}}
|
||||
onChange={(e) => update({ search: e.target.value !== "" ? e.target.value : undefined })}
|
||||
onClear={() => update({ search: undefined }, true)}
|
||||
/>
|
||||
|
||||
{withStatus &&<>
|
||||
|
||||
Reference in new issue
Block a user