|
|
|
@ -344,6 +344,8 @@ async function importFromJsonString(db, jsonString, targetPath, options) {
|
|
|
|
|
transaction.oncomplete = finish.bind(null, 'transaction complete');
|
|
|
|
|
|
|
|
|
|
_.each(remainingStoreNames, storeName => {
|
|
|
|
|
const items = importObject[storeName];
|
|
|
|
|
|
|
|
|
|
window.log.info('Importing items for store', storeName);
|
|
|
|
|
|
|
|
|
|
let count = 0;
|
|
|
|
@ -367,11 +369,12 @@ async function importFromJsonString(db, jsonString, targetPath, options) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!importObject[storeName].length) {
|
|
|
|
|
if (!items || !items.length) {
|
|
|
|
|
finishStore();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_.each(importObject[storeName], toAdd => {
|
|
|
|
|
_.each(items, toAdd => {
|
|
|
|
|
toAdd = unstringify(toAdd);
|
|
|
|
|
|
|
|
|
|
const haveGroupAlready =
|
|
|
|
@ -386,7 +389,7 @@ async function importFromJsonString(db, jsonString, targetPath, options) {
|
|
|
|
|
const request = transaction.objectStore(storeName).put(toAdd, toAdd.id);
|
|
|
|
|
request.onsuccess = () => {
|
|
|
|
|
count += 1;
|
|
|
|
|
if (count === importObject[storeName].length) {
|
|
|
|
|
if (count + skipCount >= items.length) {
|
|
|
|
|
finishStore();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|