diff --git a/js/modules/backup.js b/js/modules/backup.js index cb2a50d88b1..b33f8749040 100644 --- a/js/modules/backup.js +++ b/js/modules/backup.js @@ -346,11 +346,6 @@ async function importFromJsonString(db, jsonString, targetPath, options) { _.each(remainingStoreNames, storeName => { window.log.info('Importing items for store', storeName); - if (!importObject[storeName].length) { - delete importObject[storeName]; - return; - } - let count = 0; let skipCount = 0; @@ -372,6 +367,10 @@ async function importFromJsonString(db, jsonString, targetPath, options) { } }; + if (!importObject[storeName].length) { + finishStore(); + } + _.each(importObject[storeName], toAdd => { toAdd = unstringify(toAdd); @@ -402,7 +401,7 @@ async function importFromJsonString(db, jsonString, targetPath, options) { // We have to check here, because we may have skipped every item, resulting // in no onsuccess callback at all. - if (count === importObject[storeName].length) { + if (skipCount === count) { finishStore(); } });