Skip to content

Commit

Permalink
Merge pull request nrkno#240 from tv2/SOF-1417/listOfSchemaHasDuplicates
Browse files Browse the repository at this point in the history
Sof 1417/list of schema has duplicates
  • Loading branch information
LindvedKrvang committed Apr 20, 2023
2 parents ea01ce4 + f90be2a commit 24b38ed
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -32,7 +32,12 @@ class ConfigManifestTableEntrySelector {

const options = sourceTable.flatMap((sourceRow) => this.getOptionsFromSourceRow(sourceRow, targetRow, item))
options.push({ value: DEFAULT_VALUE_FOR_NO_AVAILABLE_OPTION, label: DEFAULT_VALUE_FOR_NO_AVAILABLE_OPTION })
return options
return this.removeDuplicateOptions(options)
}

private removeDuplicateOptions(options: SelectOption[]): SelectOption[] {
const map: Map<string, SelectOption> = new Map(options.map((option) => [option.value, option]))
return [...map.values()]
}

public getOptionsFromSourceRow(
Expand Down

0 comments on commit 24b38ed

Please sign in to comment.