fix: used set to deduplicate entries
This commit is contained in:
+1
-1
@@ -139,7 +139,7 @@
|
||||
<div class="associated-chips-container">
|
||||
@for (
|
||||
assoc of visibleAssociatedInstitutions();
|
||||
track assoc.id ?? assoc.display_name
|
||||
track assoc.id ?? assoc.display_name ?? $index
|
||||
) {
|
||||
<div class="associated-chip-wrapper">
|
||||
<app-institution-chip
|
||||
|
||||
+11
-1
@@ -166,7 +166,17 @@ export class InstitutionOverviewComponent {
|
||||
hIndex = computed(() => this.institution().summary_stats?.h_index);
|
||||
|
||||
associatedInstitutions = computed<DehydratedInstitution[]>(() => {
|
||||
return this.institution().associated_institutions ?? [];
|
||||
const list = this.institution().associated_institutions ?? [];
|
||||
const seen = new Set<string>();
|
||||
const unique: DehydratedInstitution[] = [];
|
||||
for (const item of list) {
|
||||
const key = item.id || item.display_name || JSON.stringify(item);
|
||||
if (!seen.has(key)) {
|
||||
seen.add(key);
|
||||
unique.push(item);
|
||||
}
|
||||
}
|
||||
return unique;
|
||||
});
|
||||
|
||||
showAllAssociated = signal<boolean>(false);
|
||||
|
||||
Reference in New Issue
Block a user