fix: filter out redundant group
This commit is contained in:
parent
a574d13f43
commit
ba32e42ece
1 changed files with 12 additions and 10 deletions
|
|
@ -39,17 +39,19 @@ export function MultiGroupSelect({
|
|||
|
||||
useEffect(() => {
|
||||
if (groups) {
|
||||
const groupsData = groups?.items.map((group: IGroup) => {
|
||||
const groupsData = groups?.items
|
||||
.filter((group: IGroup) => group.name.toLowerCase() !== 'everyone')
|
||||
.map((group: IGroup) => {
|
||||
return {
|
||||
value: group.id,
|
||||
label: group.name,
|
||||
};
|
||||
});
|
||||
|
||||
// Filter out existing users by their ids
|
||||
// Filter out existing groups by their ids
|
||||
const filteredGroupData = groupsData.filter(
|
||||
(user) =>
|
||||
!data.find((existingUser) => existingUser.value === user.value),
|
||||
(group) =>
|
||||
!data.find((existingGroup) => existingGroup.value === group.value),
|
||||
);
|
||||
|
||||
// Combine existing data with new search data
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue