From ebedb81e3f763da528604f0371db0a0fe09be267 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 3 Feb 2023 08:07:17 +0000 Subject: [PATCH] update idb-proxy.ts Maybe fixed #9769 --- packages/frontend/src/scripts/idb-proxy.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/scripts/idb-proxy.ts b/packages/frontend/src/scripts/idb-proxy.ts index 218682bb56..7dbca01dea 100644 --- a/packages/frontend/src/scripts/idb-proxy.ts +++ b/packages/frontend/src/scripts/idb-proxy.ts @@ -8,14 +8,15 @@ import { const fallbackName = (key: string) => `idbfallback::${key}`; -let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true; +let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && window.indexedDB.open) : true; if (idbAvailable) { - iset('idb-test', 'test').catch(err => { - console.error('idb error', err); - console.error('indexedDB is unavailable. It will use localStorage.'); - idbAvailable = false; - }); + await iset('idb-test', 'test') + .catch(err => { + console.error('idb error', err); + console.error('indexedDB is unavailable. It will use localStorage.'); + idbAvailable = false; + }); } else { console.error('indexedDB is unavailable. It will use localStorage.'); }