mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
web: fix indexedDB not getting detected
This commit is contained in:
@@ -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> = {
|
||||
|
||||
@@ -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:support@streetwriters.co");
|
||||
mailto.searchParams.set(
|
||||
"body",
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user