Removed observable addon from loading on import db

This commit is contained in:
Mitchell McCaffrey 2021-03-18 12:57:41 +11:00
parent c316f21020
commit 83d80fbbbd
3 changed files with 9 additions and 5 deletions

View File

@ -117,7 +117,7 @@ function ImportExportModal({ isOpen, onRequestClose }) {
} }
async function handleImportSelectorClose() { async function handleImportSelectorClose() {
const importDB = getDatabase({}, importDBName); const importDB = getDatabase({ addons: [] }, importDBName);
await importDB.delete(); await importDB.delete();
importDB.close(); importDB.close();
setShowImportSelector(false); setShowImportSelector(false);
@ -129,7 +129,7 @@ function ImportExportModal({ isOpen, onRequestClose }) {
setShowImportSelector(false); setShowImportSelector(false);
loadingProgressRef.current = 0; loadingProgressRef.current = 0;
const importDB = getDatabase({}, importDBName); const importDB = getDatabase({ addons: [] }, importDBName);
const db = getDatabase({}); const db = getDatabase({});
try { try {
// Keep track of a mapping of old token ids to new ones to apply them to the map states // Keep track of a mapping of old token ids to new ones to apply them to the map states

View File

@ -28,7 +28,7 @@ function SelectDataModal({
async function loadData() { async function loadData() {
if (isOpen && databaseName) { if (isOpen && databaseName) {
setIsLoading(true); setIsLoading(true);
const db = getDatabase({}, databaseName); const db = getDatabase({ addons: [] }, databaseName);
let loadedMaps = {}; let loadedMaps = {};
let loadedTokensByMap = {}; let loadedTokensByMap = {};
let loadedTokens = {}; let loadedTokens = {};

View File

@ -124,12 +124,16 @@ let service = {
} }
// Ensure import DB is cleared before importing new data // Ensure import DB is cleared before importing new data
let importDB = getDatabase({}, databaseName, 0); let importDB = getDatabase({ addons: [] }, databaseName, 0);
await importDB.delete(); await importDB.delete();
importDB.close(); importDB.close();
// Load import database up to it's desired version // Load import database up to it's desired version
importDB = getDatabase({}, databaseName, importMeta.data.databaseVersion); importDB = getDatabase(
{ addons: [] },
databaseName,
importMeta.data.databaseVersion
);
await importInto(importDB, data, { await importInto(importDB, data, {
progressCallback, progressCallback,
acceptNameDiff: true, acceptNameDiff: true,