Skip to content

Commit

Permalink
address dedup
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <menwe@amazon.com>
  • Loading branch information
mengweieric committed Oct 5, 2023
1 parent 811347c commit e8f219b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export const DataSourceSelectable = ({

// check if add new datasource group or add to existing one
if (existingGroup) {
existingGroup.options.push(...mappedOptions);
const existingOptionIds = new Set(existingGroup.options.map((opt) => opt.label));
const nonDuplicateOptions = mappedOptions.filter(
(opt) => !existingOptionIds.has(opt.label)
);
existingGroup.options.push(...nonDuplicateOptions);
} else {
finalList.push({
label: groupName,
Expand Down

0 comments on commit e8f219b

Please sign in to comment.