A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: do not interrupt importer if notebook is undefined
Abdullah Atta61b7e43d087c
diff --git a/apps/web/src/utils/importer.ts b/apps/web/src/utils/importer.tsindex 32c0afd04..b4e872903 100644--- a/apps/web/src/utils/importer.ts+++ b/apps/web/src/utils/importer.ts@@ -101,8 +101,13 @@ async function importNote(note: Note) {note.notebooks = [];const noteId = await db.notes?.add(note);- for (const notebook of notebooks) {- await db.notes?.addToNotebook(await importNotebook(notebook), noteId);+ for (const nb of notebooks) {+ const notebook = await importNotebook(nb);+ if (!notebook.id) continue;+ await db.notes?.addToNotebook(+ { id: notebook.id, topic: notebook.topic },+ noteId+ );}}@@ -111,7 +116,9 @@ async function fileToJson<T>(file: Entry) {return JSON.parse(text) as T;}-async function importNotebook(notebook: Notebook) {+async function importNotebook(+ notebook: Notebook+): Promise<{ id?: string; topic?: string }> {let nb = db.notebooks?.all.find((nb) => nb.title === notebook.notebook);if (!nb) {const nbId = await db.notebooks?.add({@@ -122,5 +129,5 @@ async function importNotebook(notebook: Notebook) {}const topic = nb?.topics.find((t: any) => t.title === notebook.topic);- return { id: nb.id, topic: topic.id };+ return { id: nb?.id, topic: topic?.id };}