Import: Properly handle import with all empty non-convo stores

This commit is contained in:
Scott Nonnenberg 2018-10-26 10:52:38 -07:00
parent ad6f7f35a4
commit e39c999932

View file

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