From 6e1cb327226d1f9dfc71ebff8063834a18db9dff Mon Sep 17 00:00:00 2001 From: James Maa Date: Tue, 16 Apr 2024 09:19:52 -0600 Subject: Remove unused canAdd (#824) Co-authored-by: James Maa --- ext/js/background/backend.js | 11 +++-------- 1 file 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; -- cgit v1.2.3