Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: destroy sql database on app close

Abdullah Atta15014d2d49bf
diff --git a/apps/web/src/common/db.ts b/apps/web/src/common/db.ts
index fac7590c6..c2b53917c 100644
--- a/apps/web/src/common/db.ts
+++ b/apps/web/src/common/db.ts
@@ -98,6 +98,10 @@ async function initializeDatabase(persistence: DatabasePersistence) {
await db.init();
+ window.addEventListener("beforeunload", () => {
+ db.sql().destroy();
+ });
+
logger.measure("Database initialization");
if (db.migrations?.required()) {