aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-09-03 22:42:27 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-09-11 16:05:39 -0400
commita9f41238d3cda62bc194f6c6cb08bae2c4eb512c (patch)
treee1485f9b8346d77072683f7b22c556abebdd4986 /ext/js
parentee2466eb22754c7f4a3296d23f8002bb97c4dfb9 (diff)
Fix repeated note IDs shown on the "View Note" button (#1927)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/display/display-anki.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index 8a023382..d17a2f0f 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -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) {
@@ -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);
}
}