Skip to content

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

web: close shared service on window close

Abdullah Attacb27039245c4
diff --git a/apps/web/src/common/sqlite/shared-service.ts b/apps/web/src/common/sqlite/shared-service.ts
index 80138de37..d79a7bdcb 100644
--- a/apps/web/src/common/sqlite/shared-service.ts
+++ b/apps/web/src/common/sqlite/shared-service.ts
@@ -75,6 +75,10 @@ export class SharedService<T extends object> extends EventTarget {
{ signal: this.#onClose.signal }
);
+ window.addEventListener("beforeunload", () => {
+ this.close();
+ });
+
this.proxy = this.#createProxy();
}