diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index c7eec977..3cebb61d 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -112,6 +112,7 @@ class RecentBooksPage extends Vue { pagination = {}; created() { + this.firstInit = true; this.pagination = {rowsPerPage: 0}; this.columns = [ @@ -167,26 +168,11 @@ class RecentBooksPage extends Vue { this.initing = true; - if (!bookManager.loaded) { - await this.updateTableData(10); - //для отзывчивости - await utils.sleep(100); - let i = 0; - let j = 5; - while (i < 500 && !bookManager.loaded) { - if (i % j == 0) { - bookManager.sortedRecentCached = null; - await this.updateTableData(20); - j *= 2; - } - - await utils.sleep(100); - i++; - } - } else { - //для отзывчивости - await utils.sleep(100); + if (this.firstInit) {//для отзывчивости + await this.updateTableData(20); + this.firstInit = false; } + await utils.sleep(50); await this.updateTableData(); this.initing = false; })(); diff --git a/client/components/Reader/ServerStorage/ServerStorage.vue b/client/components/Reader/ServerStorage/ServerStorage.vue index 0bd9cb8b..095ad5f9 100644 --- a/client/components/Reader/ServerStorage/ServerStorage.vue +++ b/client/components/Reader/ServerStorage/ServerStorage.vue @@ -580,8 +580,8 @@ class ServerStorage extends Vue { let newRecent = {}; if (!itemKey || (needSaveRecentPatch && Object.keys(newRecentPatch.data).length > 10)) { //ждем весь bm.recent - while (!bookManager.loaded) - await utils.sleep(100); + /*while (!bookManager.loaded) + await utils.sleep(100);*/ newRecent = {rev: this.cachedRecent.rev + 1, data: _.cloneDeep(bm.recent)}; newRecentPatch = {rev: this.cachedRecentPatch.rev + 1, data: {}}; diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index abfe8cdc..8a44113d 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -39,7 +39,7 @@ class BookManager { this.saveRecentItem = _.debounce(() => { bmRecentStoreNew.setItem('recent-item', this.recentItem); - this.recentRev++; + this.recentRev = (this.recentRev < 1000 ? this.recentRev + 1 : 1); bmRecentStoreNew.setItem('rev', this.recentRev); }, 200, {maxWait: 300}); @@ -64,6 +64,8 @@ class BookManager { await this.cleanRecentBooks(); + if (this.recentRev > 10) + await bmRecentStoreOld.clear(); } else {//TODO: убрать после 06.2021, когда bmRecentStoreOld устареет this.recentLast = await bmRecentStoreOld.getItem('recent-last'); if (this.recentLast) {