Parcourir la source

fix(sqlite): multitab support

Andelf il y a 2 ans
Parent
commit
0836e4f6cc

+ 10 - 9
deps/persist-db/src/index.js

@@ -93,15 +93,16 @@ const SQLiteDB = {
     },
     async init() {
         console.log("[worker] calling init");
-        const module = await SQLiteModuleFactory();
-        sqlite3 = SQLite.Factory(module);
-        // OPFS is not supported in shared worker
-        // const vfs = new OriginPrivateFileSystemVFS();
-        const vfs = new IDBBatchAtomicVFS("logseq-VFS");
-        await vfs.isReady;
-        sqlite3.vfs_register(vfs, true);
-        console.log("[worker] SQLite vfs init ok")
-        return;
+        if (typeof sqlite3 === "undefined") {
+            const module = await SQLiteModuleFactory();
+            sqlite3 = SQLite.Factory(module);
+            // OPFS is not supported in shared worker
+            // const vfs = new OriginPrivateFileSystemVFS();
+            const vfs = new IDBBatchAtomicVFS("logseq-VFS");
+            await vfs.isReady;
+            sqlite3.vfs_register(vfs, true);
+            console.log("[worker] SQLite vfs init ok")
+        }
     },
     // aka. newDB and openDB
     // :db-new

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
resources/js/ls-wa-sqlite/persist-db-worker.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
resources/js/ls-wa-sqlite/persist-db-worker.js.map


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff