Skip to content

Commit

Permalink
Filter user groups by unique groups only
Browse files Browse the repository at this point in the history
  • Loading branch information
heisbrot committed Aug 13, 2024
1 parent f30b8a4 commit c15ef98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/users/table-cells/UserGroupCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import MultipleGroups from "@components/ui/MultipleGroups";
import { uniq } from "lodash";
import React, { useState } from "react";
import { useGroups } from "@/contexts/GroupsProvider";
import { Group } from "@/interfaces/Group";
Expand All @@ -12,7 +13,7 @@ export default function UserGroupCell({ user }: Props) {
const { groups } = useGroups();

const [allGroups] = useState(() => {
return user.auto_groups
return uniq(user.auto_groups)
.map((group) => {
return groups?.find((g) => g.id == group);
})
Expand Down

0 comments on commit c15ef98

Please sign in to comment.