Skip to content

Commit 3939a15

Browse files
committed
remove duplicate protocols
1 parent 4a9f5f2 commit 3939a15

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/biorepo_components/BiorepoCollectionPageContent.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ export default function BiorepoCollectionPageContent() {
2020
// Extract and filter specs based on "Protocol" in specDescription
2121
const allFilteredSpecs = responses.flatMap((response) => response.data?.specs?.filter((spec) => spec.specDescription.includes('Protocol and Procedure')) || []);
2222

23-
setFilteredSpecs(allFilteredSpecs);
23+
const uniqueSpecsMap = new Map();
24+
allFilteredSpecs.forEach((spec) => {
25+
if (!uniqueSpecsMap.has(spec.specNumber)) {
26+
uniqueSpecsMap.set(spec.specNumber, spec);
27+
}
28+
});
29+
30+
setFilteredSpecs(Array.from(uniqueSpecsMap.values()));
2431
} catch (error) {
2532
console.error('Error fetching product specs:', error);
2633
}

0 commit comments

Comments
 (0)