Skip to content

Commit

Permalink
Fix repeated note IDs shown on the "View Note" button (FooSoft#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread committed Sep 11, 2021
1 parent ee2466e commit a9f4123
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ext/js/display/display-anki.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class DisplayAnki {
const displayTags = this._displayTags;
const dictionaryEntryDetails = this._dictionaryEntryDetails;
for (let i = 0, ii = dictionaryEntryDetails.length; i < ii; ++i) {
const allNoteIds = [];
let allNoteIds = null;
for (const {mode, canAdd, noteIds, noteInfos, ankiError} of dictionaryEntryDetails[i].modeMap.values()) {
const button = this._adderButtonFind(i, mode);
if (button !== null) {
Expand All @@ -264,14 +264,15 @@ class DisplayAnki {
}

if (Array.isArray(noteIds) && noteIds.length > 0) {
allNoteIds.push(...noteIds);
if (allNoteIds === null) { allNoteIds = new Set(); }
for (const noteId of noteIds) { allNoteIds.add(noteId); }
}

if (displayTags !== 'never' && Array.isArray(noteInfos)) {
this._setupTagsIndicator(i, noteInfos);
}
}
this._updateViewNoteButton(i, allNoteIds, false);
this._updateViewNoteButton(i, allNoteIds !== null ? [...allNoteIds] : [], false);
}
}

Expand Down

0 comments on commit a9f4123

Please sign in to comment.