fix: prevent undefined hierarchy and missing metrics in topic tooltip #274

Merged
Louis merged 1 commits from refactor/topic-chips into dev 2026-08-11 11:18:23 +02:00
3 changed files with 28 additions and 17 deletions
@@ -35,18 +35,20 @@
</div>
</mat-card-content>
<mat-divider />
@if (topic.id) {
<mat-divider />
<mat-card-footer>
<mat-card-actions class="card-actions">
<a
class="card-action"
[routerLink]="['/topic', stripOpenAlexId(topic.id), 'publications']"
matButton="outlined"
(click)="$event.stopPropagation()">
<mat-icon>menu_book</mat-icon>
Publikationen
</a>
</mat-card-actions>
</mat-card-footer>
<mat-card-footer>
<mat-card-actions class="card-actions">
<a
class="card-action"
[routerLink]="['/topic', stripOpenAlexId(topic.id), 'publications']"
matButton="outlined"
(click)="$event.stopPropagation()">
<mat-icon>menu_book</mat-icon>
Publikationen
</a>
</mat-card-actions>
</mat-card-footer>
}
</mat-card>
@@ -35,7 +35,13 @@ export class AppTopicCardComponent {
}
subtitle = computed(() => {
return `${this.topic().subfield?.display_name} - ${this.topic().field?.display_name} - ${this.topic().domain?.display_name}`;
return [
this.topic().subfield?.display_name,
this.topic().field?.display_name,
this.topic().domain?.display_name,
]
.filter((part) => Boolean(part))
.join(' - ');
});
description = computed(() => {
@@ -24,9 +24,12 @@ export class AppTopicTooltipComponent {
const hasCompleteMetrics = Boolean(
topicObj &&
(topicObj.description ||
topicObj.works_count !== undefined ||
topicObj.cited_by_count !== undefined),
topicObj.description &&
topicObj.works_count !== undefined &&
topicObj.cited_by_count !== undefined &&
topicObj.subfield &&
topicObj.field &&
topicObj.domain,
);
if (hasCompleteMetrics && topicObj) {