From 8bfb6173874fd24d9fc3ab85fef74549faeffb3b Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 22 Feb 2024 23:26:25 +0500 Subject: [PATCH] core: remove note's vault relation regardless of vault --- packages/core/src/api/vault.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/src/api/vault.ts b/packages/core/src/api/vault.ts index 55d433f3e..ea1c7e199 100644 --- a/packages/core/src/api/vault.ts +++ b/packages/core/src/api/vault.ts @@ -180,9 +180,8 @@ export default class Vault { async remove(noteId: string, password: string) { await this.unlockNote(noteId, password, true); - const vault = await this.db.vaults.default(); - if (!vault) await this.create(password); - else await this.db.relations.unlink(vault, { id: noteId, type: "note" }); + if (!(await this.exists())) await this.create(password); + await this.db.relations.to({ id: noteId, type: "note" }, "vault").unlink(); } /**