web: fix indexedDB not getting detected

This commit is contained in:
Abdullah Atta
2024-02-07 15:59:48 +05:00
parent 8bdd4b2638
commit 6c868fb589
3 changed files with 9 additions and 5 deletions

View File

@@ -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> = {

View File

@@ -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",

View File

@@ -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))