From b69902dd84de3784036d228353b40ac92478e1aa Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Mon, 19 Feb 2024 13:13:28 +0000 Subject: [PATCH] Deduplicate integrations in the JobListPresenter (#901) --- apps/webapp/app/presenters/JobListPresenter.server.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/webapp/app/presenters/JobListPresenter.server.ts b/apps/webapp/app/presenters/JobListPresenter.server.ts index e9bb16ee0..d39accaf7 100644 --- a/apps/webapp/app/presenters/JobListPresenter.server.ts +++ b/apps/webapp/app/presenters/JobListPresenter.server.ts @@ -145,6 +145,12 @@ export class JobListPresenter { setupStatus: integration.integration.setupStatus, })); + //deduplicate integrations + const uniqueIntegrations = new Map(); + integrations.forEach((i) => { + uniqueIntegrations.set(i.key, i); + }); + let properties: DisplayProperty[] = []; if (eventSpecification.properties) { @@ -176,7 +182,7 @@ export class JobListPresenter { }` : undefined, }, - integrations, + integrations: Array.from(uniqueIntegrations.values()), hasIntegrationsRequiringAction: integrations.some( (i) => i.setupStatus === "MISSING_FIELDS" ),