Fix db crash

This commit is contained in:
binwiederhier
2026-01-13 21:29:44 -05:00
parent 44f20f6b4c
commit dd9b36cf0a

View File

@@ -18,6 +18,13 @@ const createDatabase = (username) => {
prefs: "&key",
});
// When another connection (e.g., service worker or another tab) wants to upgrade,
// close this connection gracefully to allow the upgrade to proceed
db.on("versionchange", () => {
console.log("[db] versionchange event: closing database");
db.close();
});
return db;
};