Skip to content

Commit

Permalink
Remove duplicate engagements in combobox options (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathildehaugum authored Dec 13, 2023
1 parent c5e2987 commit cdc4046
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/components/Staffing/AddEngagementForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function AddEngagementForm({
}) as SelectOption,
);

let uniqueLabels = new Set();
const projectOptions =
customers
.find((c) => c.customerId == selectedCustomer?.value)
Expand All @@ -68,7 +69,9 @@ export function AddEngagementForm({
value: `${e.engagementId}`,
label: `${e.engagementName}`,
}) as SelectOption,
) ?? [];
)
.filter((e) => !uniqueLabels.has(e.label) && uniqueLabels.add(e.label)) ??
[];

const consultantOptions =
consultants.map(
Expand Down

0 comments on commit cdc4046

Please sign in to comment.