diff options
| author | James Maa <jmaa@berkeley.edu> | 2024-04-16 09:19:52 -0600 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-16 15:19:52 +0000 | 
| commit | 6e1cb327226d1f9dfc71ebff8063834a18db9dff (patch) | |
| tree | f5326d5fd5cc84791cbc4f2f7da9ccfacec3d563 | |
| parent | 643caf0da12d4ffb39989a39931cf0769f1246a0 (diff) | |
Remove unused canAdd (#824)
Co-authored-by: James Maa <jamesmaa@Jamess-MacBook-Pro.local>
| -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; |