aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-04-15 13:25:53 -0400
committerGitHub <noreply@github.com>2024-04-15 17:25:53 +0000
commitf5a6b25e8d3331fce1cc5145bb7b21f2081743fe (patch)
tree1b68e9f43f8a898786674296d27faa8d50142110 /ext/js
parentef4304979db6a7e08b3dae1eca7e614a0ef30f1a (diff)
Fix noteInfos not getting assigned (#819)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/background/backend.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 569cb53d..881cd241 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -609,10 +609,14 @@ export class Backend {
const valid = isNoteDataValid(note);
+ const noteIds = isDuplicate ? duplicateNoteIds[originalIndices.indexOf(i)] : null;
+ const noteInfos = (fetchAdditionalInfo && noteIds !== null && noteIds.length > 0) ? await this._anki.notesInfo(noteIds) : [];
+
const info = {
canAdd: valid,
valid,
- noteIds: isDuplicate ? duplicateNoteIds[originalIndices.indexOf(i)] : null
+ noteIds: noteIds,
+ noteInfos: noteInfos
};
results.push(info);
@@ -622,20 +626,6 @@ export class Backend {
}
}
- if (cannotAdd.length > 0) {
- const cannotAddNotes = cannotAdd.map(({note}) => note);
- const noteIdsArray = await this._anki.findNoteIds(cannotAddNotes);
- for (let i = 0, ii = Math.min(cannotAdd.length, noteIdsArray.length); i < ii; ++i) {
- const noteIds = noteIdsArray[i];
- if (noteIds.length > 0) {
- cannotAdd[i].info.noteIds = noteIds;
- if (fetchAdditionalInfo) {
- cannotAdd[i].info.noteInfos = await this._anki.notesInfo(noteIds);
- }
- }
- }
- }
-
return results;
}