1
0

Automatically reopen DB when closed (e.g. due to SW update)

This commit is contained in:
Zef Hemel 2023-07-07 15:45:52 +02:00
parent fd6f81d500
commit e98495fb50

View File

@ -118,6 +118,11 @@ async function handleLocalFileRequest(
// Not initialzed yet, or explicitly in sync mode (so direct server communication requested)
return fetch(request);
}
if (!db?.isOpen()) {
console.log("Detected that the DB was closed, reopening");
await db!.open();
}
const path = decodeURIComponent(pathname.slice(1));
const data = await fileContentTable.get(path);
if (data) {