diff options
| author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-04-15 13:25:53 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-15 17:25:53 +0000 | 
| commit | f5a6b25e8d3331fce1cc5145bb7b21f2081743fe (patch) | |
| tree | 1b68e9f43f8a898786674296d27faa8d50142110 | |
| parent | ef4304979db6a7e08b3dae1eca7e614a0ef30f1a (diff) | |
Fix noteInfos not getting assigned (#819)
| -rw-r--r-- | ext/js/background/backend.js | 20 | 
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;      } |