Skip to content

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

web: fix web app not working on mobile devices

Abdullah Attac097c4d457c1
diff --git a/apps/web/src/common/db.ts b/apps/web/src/common/db.ts
index 886eb0c94..20903d612 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 = isFeatureSupported("opfs");
+ const multiTab = !!globalThis.SharedWorker && 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 7eeabc446..d482938a7 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 = isFeatureSupported("opfs");
+ const multiTab = !!globalThis.SharedWorker && 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 98a242883..90d679e76 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 = isFeatureSupported("opfs");
+ const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
await initialize(
{
dialect: (name, init) =>