fix(webui): properly reload series when book read progress is updated

This commit is contained in:
Gauthier Roebroeck 2021-07-02 16:36:24 +08:00
parent ada1438921
commit 92954e0916
4 changed files with 12 additions and 5 deletions

View file

@ -368,7 +368,7 @@ export default Vue.extend({
}, },
reloadSeries: throttle(function (this: any) { reloadSeries: throttle(function (this: any) {
this.loadSeries(this.collectionId) this.loadSeries(this.collectionId)
}, 5000), }, 1000),
async loadSeries(collectionId: string) { async loadSeries(collectionId: string) {
let authorsFilter = [] as AuthorDto[] let authorsFilter = [] as AuthorDto[]
authorRoles.forEach((role: string) => { authorRoles.forEach((role: string) => {

View file

@ -452,7 +452,7 @@ export default Vue.extend({
}, },
reloadPage: throttle(function (this: any) { reloadPage: throttle(function (this: any) {
this.loadPage(this.libraryId, this.page, this.sortActive) this.loadPage(this.libraryId, this.page, this.sortActive)
}, 5000), }, 1000),
async loadPage(libraryId: string, page: number, sort: SortActive) { async loadPage(libraryId: string, page: number, sort: SortActive) {
this.selectedSeries = [] this.selectedSeries = []

View file

@ -177,7 +177,7 @@ export default Vue.extend({
}, },
reloadBooks: throttle(function (this: any) { reloadBooks: throttle(function (this: any) {
this.loadBooks(this.readListId) this.loadBooks(this.readListId)
}, 5000), }, 1000),
editSingleBook (book: BookDto) { editSingleBook (book: BookDto) {
this.$store.dispatch('dialogUpdateBooks', book) this.$store.dispatch('dialogUpdateBooks', book)
}, },

View file

@ -686,7 +686,10 @@ export default Vue.extend({
if (event.seriesId === this.seriesId) this.reloadPage() if (event.seriesId === this.seriesId) this.reloadPage()
}, },
readProgressChanged(event: ReadProgressSseDto) { readProgressChanged(event: ReadProgressSseDto) {
if (this.books.some(b => b.id === event.bookId)) this.reloadPage() if (this.books.some(b => b.id === event.bookId)) {
this.reloadPage()
this.reloadSeries()
}
}, },
collectionChanged(event: CollectionSseDto) { collectionChanged(event: CollectionSseDto) {
if (event.seriesIds.includes(this.seriesId) || this.collections.map(x => x.id).includes(event.collectionId)) { if (event.seriesIds.includes(this.seriesId) || this.collections.map(x => x.id).includes(event.collectionId)) {
@ -696,7 +699,11 @@ export default Vue.extend({
}, },
reloadPage: throttle(function (this: any) { reloadPage: throttle(function (this: any) {
this.loadPage(this.seriesId, this.page, this.sortActive) this.loadPage(this.seriesId, this.page, this.sortActive)
}, 5000), }, 1000),
reloadSeries: throttle(function (this: any) {
this.$komgaSeries.getOneSeries(this.seriesId)
.then((v: SeriesDto) => this.series = v)
}, 1000),
async loadSeries(seriesId: string) { async loadSeries(seriesId: string) {
this.$komgaSeries.getOneSeries(seriesId) this.$komgaSeries.getOneSeries(seriesId)
.then(v => this.series = v) .then(v => this.series = v)