More UserSearch useEffect stabilization attempts
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2026-03-22 21:05:20 +02:00
parent 8cf2c028e1
commit ad64cff26d

View File

@@ -66,16 +66,19 @@ export const UserSearch = React.forwardRef(function UserSearch<
};
// clear if selected user is not in the new filtered items
const itemsJoined = items.map((user) => user.id).join(",");
React.useEffect(() => {
const ids = itemsJoined.split(",").map(Number);
if (
selectedKey &&
selectedKey !== initialUserId &&
!items.some((user) => user.id === selectedKey)
!ids.includes(selectedKey)
) {
setSelectedKey(null);
onChange?.(null);
}
}, [items, selectedKey, onChange, initialUserId]);
}, [itemsJoined, selectedKey, onChange, initialUserId]);
return (
<Select