Поправка бага

This commit is contained in:
Book Pauk
2019-10-17 20:38:52 +07:00
parent bfb37e55d4
commit 93cf506535
2 changed files with 10 additions and 3 deletions

View File

@@ -519,7 +519,7 @@ class Reader extends Vue {
} }
if (oldBook && newBook) { if (oldBook && newBook) {
if (oldBook.key != newBook.key) { if (oldBook.key != newBook.key || oldBook.path != newBook.path) {
this.loadingBook = true; this.loadingBook = true;
try { try {
await this.loadBook(newBook); await this.loadBook(newBook);
@@ -934,7 +934,9 @@ class Reader extends Vue {
// уже просматривается сейчас // уже просматривается сейчас
const lastBook = (this.textPage ? this.textPage.lastBook : null); const lastBook = (this.textPage ? this.textPage.lastBook : null);
if (!opts.force && lastBook && lastBook.url == url && await bookManager.hasBookParsed(lastBook)) { if (!opts.force && lastBook && lastBook.url == url &&
(!opts.path || opts.path == lastBook.path) &&
await bookManager.hasBookParsed(lastBook)) {
this.loaderActive = false; this.loaderActive = false;
return; return;
} }
@@ -963,7 +965,7 @@ class Reader extends Vue {
if (!opts.force) { if (!opts.force) {
// пытаемся загрузить и распарсить книгу в менеджере из локального кэша // пытаемся загрузить и распарсить книгу в менеджере из локального кэша
const bookParsed = await bookManager.getBook({url}, (prog) => { const bookParsed = await bookManager.getBook({url, path: opts.path}, (prog) => {
progress.setState({progress: prog}); progress.setState({progress: prog});
}); });

View File

@@ -262,6 +262,11 @@ class BookManager {
this.books[meta.key] = result; this.books[meta.key] = result;
} }
//Если файл на сервере изменился, считаем, что в кеше его нету
if (meta.path && result && meta.path != result.path) {
return;
}
if (result && !result.parsed) { if (result && !result.parsed) {
let data = await bmDataStore.getItem(`bmData-${meta.key}`); let data = await bmDataStore.getItem(`bmData-${meta.key}`);
callback(5); callback(5);