diff options
-rw-r--r-- | ext/js/background/backend.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index b0c0a36d..deaef4a0 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -569,11 +569,10 @@ export class Backend { async _onApiGetAnkiNoteInfo({notes, fetchAdditionalInfo}) { const {canAddArray, cannotAddArray} = await this.partitionAddibleNotes(notes); - /** @type {{note: import('anki').Note, info: import('anki').NoteInfoWrapper}[]} */ - const cannotAdd = cannotAddArray.filter((note) => isNoteDataValid(note)).map((note) => ({note, info: {canAdd: false, valid: false, noteIds: null}})); - /** @type {import('anki').NoteInfoWrapper[]} */ - const results = cannotAdd.map(({info}) => info); + const results = cannotAddArray + .filter((note) => isNoteDataValid(note)) + .map(() => ({canAdd: false, valid: false, noteIds: null})); /** @type {import('anki').Note[]} */ const duplicateNotes = []; @@ -607,10 +606,6 @@ export class Backend { }; results.push(info); - - if (!valid) { - cannotAdd.push({note, info}); - } } return results; |