From 8b8b80a25760b3daa3afa8d3815bd1ffdc039752 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 28 Mar 2025 20:56:09 +0500 Subject: [PATCH] web: remove SharedWorker requirement for multi tab sqlite driver --- apps/web/src/common/db.ts | 2 +- apps/web/src/components/error-boundary/index.tsx | 2 +- apps/web/src/utils/logger.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/common/db.ts b/apps/web/src/common/db.ts index 20903d612..886eb0c94 100644 --- a/apps/web/src/common/db.ts +++ b/apps/web/src/common/db.ts @@ -56,7 +56,7 @@ async function initializeDatabase(persistence: DatabasePersistence) { ); await storage.migrate(); - const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs"); + const multiTab = isFeatureSupported("opfs"); database.setup({ sqliteOptions: { dialect: (name, init) => diff --git a/apps/web/src/components/error-boundary/index.tsx b/apps/web/src/components/error-boundary/index.tsx index d482938a7..7eeabc446 100644 --- a/apps/web/src/components/error-boundary/index.tsx +++ b/apps/web/src/components/error-boundary/index.tsx @@ -247,7 +247,7 @@ function errorToString(error: unknown) { } async function resetDatabase() { - const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs"); + const multiTab = isFeatureSupported("opfs"); await useKeyStore.getState().clear(); const dialect = createDialect({ name: "notesnook", diff --git a/apps/web/src/utils/logger.ts b/apps/web/src/utils/logger.ts index 90d679e76..98a242883 100644 --- a/apps/web/src/utils/logger.ts +++ b/apps/web/src/utils/logger.ts @@ -27,7 +27,7 @@ import { isFeatureSupported } from "./feature-check"; let logger: typeof _logger = new NoopLogger(); async function initializeLogger() { - const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs"); + const multiTab = isFeatureSupported("opfs"); await initialize( { dialect: (name, init) =>