Changed db import to use importInto
This commit is contained in:
parent
8117f7da2e
commit
57e64e132b
src
@ -35,7 +35,6 @@ function ImportDatabaseModal({ isOpen, onRequestClose }) {
|
||||
async function handleImportDatabase(file) {
|
||||
setIsLoading(true);
|
||||
backgroundTaskRunningRef.current = true;
|
||||
await database.delete();
|
||||
await worker.importData(file, Comlink.proxy(handleDBProgress));
|
||||
setIsLoading(false);
|
||||
backgroundTaskRunningRef.current = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Comlink from "comlink";
|
||||
import { importDB, exportDB } from "dexie-export-import";
|
||||
import { importInto, exportDB } from "dexie-export-import";
|
||||
import { encode } from "@msgpack/msgpack";
|
||||
|
||||
import { getDatabase } from "../database";
|
||||
@ -59,7 +59,8 @@ let service = {
|
||||
*/
|
||||
async importData(data, progressCallback) {
|
||||
try {
|
||||
await importDB(data, { progressCallback });
|
||||
let db = getDatabase({});
|
||||
await importInto(db, data, { progressCallback, overwriteValues: true });
|
||||
} catch {}
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user