filter selected out of the options in search

This commit is contained in:
talksik
2022-05-30 07:21:14 -05:00
parent 5396f8a568
commit 1e3d26f664
@@ -44,19 +44,7 @@ export default function NewConversationDialog({
const handleChangeSelections = useCallback( const handleChangeSelections = useCallback(
(e: React.SyntheticEvent<Element, Event>, value: User[], reason: AutocompleteChangeReason) => { (e: React.SyntheticEvent<Element, Event>, value: User[], reason: AutocompleteChangeReason) => {
const newUsers: User[] = []; setSelectedUsers(value);
value.forEach((val) => {
if (typeof val !== 'string') return;
newUsers.push(val);
});
console.log(value);
console.log(newUsers);
setSelectedUsers(newUsers);
}, },
[], [],
); );
@@ -146,6 +134,7 @@ export default function NewConversationDialog({
value={selectedUsers} value={selectedUsers}
onChange={handleChangeSelections} onChange={handleChangeSelections}
filterSelectedOptions filterSelectedOptions
isOptionEqualToValue={(optionUser, valueUser) => optionUser.id === valueUser.id}
filterOptions={(options) => options} filterOptions={(options) => options}
inputValue={searchVal} inputValue={searchVal}
renderInput={(params) => ( renderInput={(params) => (