From 2090a79741c91cc67f03015ca337b80f89493df9 Mon Sep 17 00:00:00 2001 From: sabrine33 Date: Thu, 17 Oct 2024 11:47:55 +0100 Subject: [PATCH] remove duplicate rows (where external ID and address are the same) in the table on Xenium Analyser QC and Xenium metrics pages --- src/components/xeniumMetrics/RoiTable.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/xeniumMetrics/RoiTable.tsx b/src/components/xeniumMetrics/RoiTable.tsx index 90aeb4b6..1d4f330f 100644 --- a/src/components/xeniumMetrics/RoiTable.tsx +++ b/src/components/xeniumMetrics/RoiTable.tsx @@ -19,10 +19,10 @@ export const groupByRoi = (rois: RoiFieldsFragment[]): Record alphaNumericSortDefault(a.address, b.address)) .reduce( (acc, data) => { - if (!acc[data.roi]) { - acc[data.roi] = []; + const roiGroup = acc[data.roi] || (acc[data.roi] = []); + if (!roiGroup.some((item) => item.address === data.address && item.sample.id === data.sample.id)) { + roiGroup.push(data); } - acc[data.roi].push(data); return acc; }, {} as Record