diff --git a/apps/web/src/components/editor/header.tsx b/apps/web/src/components/editor/header.tsx index 85a499f52..d6c871c30 100644 --- a/apps/web/src/components/editor/header.tsx +++ b/apps/web/src/components/editor/header.tsx @@ -50,6 +50,7 @@ function Header(props: HeaderProps) { const id = (await db.tags.find(value))?.id ?? (await db.tags.add({ title: value })); + if (!id) return; await db.relations.add({ id, type: "tag" }, { type: "note", id: noteId }); await useTagStore.getState().refresh(); } diff --git a/apps/web/src/dialogs/add-notebook-dialog.tsx b/apps/web/src/dialogs/add-notebook-dialog.tsx index 54996d79e..4e9394f45 100644 --- a/apps/web/src/dialogs/add-notebook-dialog.tsx +++ b/apps/web/src/dialogs/add-notebook-dialog.tsx @@ -49,6 +49,8 @@ export const AddNotebookDialog = DialogManager.register( title: title.current, description: description.current }); + if (!id) return; + if (parentId) { await db.relations.add( { type: "notebook", id: parentId }, diff --git a/apps/web/src/utils/feature-check.ts b/apps/web/src/utils/feature-check.ts index ae9ecc085..11813d05f 100644 --- a/apps/web/src/utils/feature-check.ts +++ b/apps/web/src/utils/feature-check.ts @@ -22,7 +22,7 @@ const FEATURE_CHECKS = { cache: false, indexedDB: false, clonableCryptoKey: false, - applePaySupported: window.ApplePaySession?.canMakePayments() + applePaySupported: !!window.ApplePaySession?.canMakePayments() }; async function isOPFSSupported() { diff --git a/apps/web/src/utils/importer.ts b/apps/web/src/utils/importer.ts index 8635671ec..9411c6e51 100644 --- a/apps/web/src/utils/importer.ts +++ b/apps/web/src/utils/importer.ts @@ -145,6 +145,7 @@ async function processNote(entry: ZipEntry, attachments: Record) { (await db.tags.add({ title: tag })); + if (!tagId) continue; await db.relations.add( { @@ -166,6 +167,7 @@ async function processNote(entry: ZipEntry, attachments: Record) { colorCode: colorCode, title: note.color })); + if (!colorId) return; await db.relations.add( {