From 1db9932cbdd0654e7483287df74cb4df652081ef Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Thu, 9 May 2024 10:10:50 -0400 Subject: [PATCH] :bug: Remove duplicate targets in advanced options screen Signed-off-by: Ian Bolton --- .../analysis-wizard/set-options.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/client/src/app/pages/applications/analysis-wizard/set-options.tsx b/client/src/app/pages/applications/analysis-wizard/set-options.tsx index e281acdccd..d7f8fc1be4 100644 --- a/client/src/app/pages/applications/analysis-wizard/set-options.tsx +++ b/client/src/app/pages/applications/analysis-wizard/set-options.tsx @@ -68,14 +68,21 @@ export const SetOptions: React.FC = () => { } }); - const defaultTargetsAndTargetsLabels = [ - ...defaultTargets, - ...allTargetLabelsFromTargets, - ].sort((t1, t2) => universalComparator(t1.label, t2.label)); + const defaultTargetsAndTargetsLabels = Array.from( + new Map( + defaultTargets + .concat(allTargetLabelsFromTargets) + .map((item) => [item.label, item]) + ).values() + ).sort((t1, t2) => universalComparator(t1.label, t2.label)); - const defaultSourcesAndSourcesLabels = [ - ...new Set(defaultSources.concat(allSourceLabelsFromTargets)), - ]; + const defaultSourcesAndSourcesLabels = Array.from( + new Map( + defaultSources + .concat(allSourceLabelsFromTargets) + .map((item) => [item.label, item]) + ).values() + ).sort((t1, t2) => universalComparator(t1.label, t2.label)); return (