Исправление багов

This commit is contained in:
Book Pauk
2022-07-11 17:12:17 +07:00
parent 1b4360b897
commit 125a2e0f17

View File

@@ -79,8 +79,8 @@ class BookManager {
if (converted) if (converted)
return; return;
for (const key in this.recent) { const newRecent = {};
const book = this.recent[key]; for (const book of Object.values(this.recent)) {
if (!book.path) { if (!book.path) {
continue; continue;
@@ -88,18 +88,18 @@ class BookManager {
const newKey = this.keyFromPath(book.path); const newKey = this.keyFromPath(book.path);
if (!book.deleted && key !== newKey || book.key !== newKey) { newRecent[newKey] = _.cloneDeep(book);
this.recent[newKey] = _.cloneDeep(book); newRecent[newKey].key = newKey;
this.recent[newKey].key = newKey;
book.deleted = 1;
}
} }
this.recent = newRecent;
//console.log(converted); //console.log(converted);
(async() => { (async() => {
await utils.sleep(3000); await utils.sleep(3000);
this.saveRecent(); this.saveRecent();
this.emit('recent-changed'); this.emit('recent-changed');
this.emit('set-recent');
await bmRecentStoreNew.setItem('recent-converted', true); await bmRecentStoreNew.setItem('recent-converted', true);
})(); })();
} }