Skip to content

Commit

Permalink
fix: properly handle undefined pubtator abstracts
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Jan 3, 2024
1 parent a6c436f commit 103bce3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/GeneDetails/LiteratureCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const extractPassageAnnotations = (passage: any): Annotation[] => {
const extractAnnotations = (abstract: any): Annotation[] => {
const seen: Set<string> = new Set()
const annotations: Annotation[] = []
for (const passage of abstract.passages) {
for (const passage of abstract?.passages ?? []) {
for (const annotation of extractPassageAnnotations(passage)) {
if (seen.has(annotation.name ?? annotation.text ?? '')) {
continue
Expand Down Expand Up @@ -223,7 +223,7 @@ watch(() => props.geneInfo?.hgnc?.symbol, loadPubTator)
<!-- eslint-enable -->
</div>
<div class="text-body-2 text-grey-darken-1">
{{ pubtatorStore.searchResults[pmid]?.abstract.authors.join(', ') }}
{{ pubtatorStore.searchResults[pmid]?.abstract?.authors.join(', ') }}
</div>
</div>
<div v-else-if="passage.infons.type === 'abstract'">
Expand All @@ -239,10 +239,10 @@ watch(() => props.geneInfo?.hgnc?.symbol, loadPubTator)
</div>
</div>
<div v-if="extractAnnotations(pubtatorStore.searchResults[pmid].abstract).length > 0">
<div v-if="extractAnnotations(pubtatorStore.searchResults[pmid]?.abstract).length > 0">
<template
v-for="(annotation, idxInner) in extractAnnotations(
pubtatorStore.searchResults[pmid].abstract
pubtatorStore.searchResults[pmid]?.abstract
)"
:key="idxInner"
>
Expand Down

0 comments on commit 103bce3

Please sign in to comment.