Skip to content

Commit

Permalink
Import: Properly handle import with all empty non-convo stores
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Oct 26, 2018
1 parent ad6f7f3 commit e39c999
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions js/modules/backup.js
Expand Up @@ -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;

Expand All @@ -372,6 +367,10 @@ async function importFromJsonString(db, jsonString, targetPath, options) {
}
};

if (!importObject[storeName].length) {
finishStore();
}

_.each(importObject[storeName], toAdd => {
toAdd = unstringify(toAdd);

Expand Down Expand Up @@ -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();
}
});
Expand Down

0 comments on commit e39c999

Please sign in to comment.