Skip to content

Commit

Permalink
Fixing duplicated integrations entries
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrdyn committed Apr 26, 2024
1 parent de89bb2 commit 7c14347
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ export const useDatasetQualityFilters = () => {
);

const integrationItems: IntegrationItem[] = useMemo(() => {
const integrationsMap = datasets.reduce(
(acc, dataset) => ({
...acc,
...(dataset.integration && !acc[dataset.integration.name]
? { [dataset.integration.name]: dataset.integration }
: {}),
}),
{} as { [key: string]: Integration }
);

const integrations = [
...datasets
.map((dataset) => dataset.integration)
.filter((integration): integration is Integration => !!integration),
...Object.values(integrationsMap),
...(datasets.some((dataset) => !dataset.integration)
? [Integration.create({ name: 'none', title: 'None' })]
: []),
Expand Down

0 comments on commit 7c14347

Please sign in to comment.