Skip to content

Commit

Permalink
Fix broken dict data display on missing entries
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Aug 1, 2023
1 parent 56d782c commit 6b514f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions vedaweb-frontend/src/components/display/DictionaryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class DictionaryView extends Component {
let t = lemmaData[i];

t["dict"] = t.lemmaRefs.map(ref => {
let entry = entries.find(e => e.id === ref) || {};
return this.parseEntry(entry, parser);
let entry = entries.find(e => e.id === ref);
return entry ? this.parseEntry(entry, parser) : undefined;
});
dictData.push(t);
}
Expand Down Expand Up @@ -199,12 +199,12 @@ class DictionaryView extends Component {
<span>({token.tokens.map((t, i ) => t + (i < token.tokens.length - 1 ? ", " : ""))})</span>
</td>
<td className="expanding text-font">
{token.dict && token.dict[0] && token.dict[0].graTxt}
{token.dict && token.dict[0] && token.dict[0].graTxt || ""}
</td>
<td className="non-expanding">
{token.lemmaRefs && token.lemmaRefs.map((ref, i) => {
let entry = token.dict === undefined ? undefined
: token.dict.find(d => d.graRef === ref);
const entry = !token.dict ? null
: token.dict.find(d => d && d.graRef === ref);
return entry ? <Button
disabled={!isLoaded || error}
className="dict-link gap-right"
Expand Down

0 comments on commit 6b514f1

Please sign in to comment.