Skip to content

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

web: fix indexedDB not getting detected

Abdullah Atta487306b94392
diff --git a/apps/web/src/bootstrap.tsx b/apps/web/src/bootstrap.tsx
index 352525645..f91942448 100644
--- a/apps/web/src/bootstrap.tsx
+++ b/apps/web/src/bootstrap.tsx
@@ -23,7 +23,7 @@ import { getCurrentHash, getCurrentPath, makeURL } from "./navigation";
import Config from "./utils/config";
import { initializeLogger, logger } from "./utils/logger";
-import { AuthProps } from "./views/auth";
+import type { AuthProps } from "./views/auth";
import { initializeFeatureChecks } from "./utils/feature-check";
type Route<TProps = null> = {
diff --git a/apps/web/src/components/error-boundary/index.tsx b/apps/web/src/components/error-boundary/index.tsx
index 0d9ac5bc0..dc3248aca 100644
--- a/apps/web/src/components/error-boundary/index.tsx
+++ b/apps/web/src/components/error-boundary/index.tsx
@@ -29,7 +29,6 @@ import Logo from "../../assets/logo.svg";
import LogoDark from "../../assets/logo-dark.svg";
import { useStore as useThemeStore } from "../../stores/theme-store";
import { createDialect } from "../../common/sqlite";
-import { getDeviceInfo } from "../../dialogs/issue-dialog";
export function ErrorBoundary(props: PropsWithChildren) {
return (
@@ -96,7 +95,10 @@ export function ErrorComponent({ error, resetErrorBoundary }: FallbackProps) {
<Button
variant="secondary"
sx={{ alignSelf: "start", px: 30, mt: 1 }}
- onClick={() => {
+ onClick={async () => {
+ const { getDeviceInfo } = await import(
+ "../../dialogs/issue-dialog"
+ );
const mailto = new URL("mailto:[email protected]");
mailto.searchParams.set(
"body",
diff --git a/apps/web/src/utils/feature-check.ts b/apps/web/src/utils/feature-check.ts
index 932f2878e..b107405b3 100644
--- a/apps/web/src/utils/feature-check.ts
+++ b/apps/web/src/utils/feature-check.ts
@@ -51,13 +51,15 @@ async function isCacheSupported() {
}
async function isIndexedDBSupported() {
- console.log("IS indexed db supported");
const hasIndexedDB = "indexedDB" in window;
return (
hasIndexedDB &&
(await new Promise((resolve, reject) => {
const request = indexedDB.open("checkIDBSupport");
- request.onsuccess = resolve;
+ request.onsuccess = () => {
+ request.result.close();
+ resolve(undefined);
+ };
request.onerror = reject;
})
.then(() => (FEATURE_CHECKS.indexedDB = true))