ui: fix selectUser (#1031)

This commit is contained in:
undefined committed 2025-08-08 03:27:37 +08:00
1 parent a255f53aa5
commit 17ab8b5bb0
5 files changed
+30 -19

No files matched your search

@@ -126,10 +126,8 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
else onChange(selectedKeys.filter((v) => v?.trim().length).join(','));
};
let first = !multi;
useEffect(() => {
if (first) first = false;
else dispatchChange();
dispatchChange();
if (!multi) return; // Load pre-selected items only in multi mode
const ids = [];
for (const key of selectedKeys) if (!valueCache[key]) ids.push(key);
@@ -161,7 +159,6 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
setSelectedKeys([key]);
inputRef.current.value = key;
}
dispatchChange();
if (!shouldKeepOpen) {
setItemList([]);
setCurrentItem(null);