mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-07 01:15:44 +02:00
Fix:Bookshelf rebuild when server settings are set (race condition) #247
This commit is contained in:
parent
c89319ffc5
commit
43668cfe03
@ -380,7 +380,7 @@ export default {
|
|||||||
if (wasUpdated) {
|
if (wasUpdated) {
|
||||||
this.resetEntities()
|
this.resetEntities()
|
||||||
} else if (settings.bookshelfCoverSize !== this.currentBookWidth) {
|
} else if (settings.bookshelfCoverSize !== this.currentBookWidth) {
|
||||||
this.rebuild()
|
this.executeRebuild()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scroll(e) {
|
scroll(e) {
|
||||||
@ -461,12 +461,19 @@ export default {
|
|||||||
var lastBookIndex = Math.min(this.totalEntities, this.shelvesPerPage * this.entitiesPerShelf)
|
var lastBookIndex = Math.min(this.totalEntities, this.shelvesPerPage * this.entitiesPerShelf)
|
||||||
this.mountEntites(0, lastBookIndex)
|
this.mountEntites(0, lastBookIndex)
|
||||||
},
|
},
|
||||||
windowResize() {
|
executeRebuild() {
|
||||||
clearTimeout(this.resizeTimeout)
|
clearTimeout(this.resizeTimeout)
|
||||||
this.resizeTimeout = setTimeout(() => {
|
this.resizeTimeout = setTimeout(() => {
|
||||||
this.rebuild()
|
this.rebuild()
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
|
windowResize() {
|
||||||
|
this.executeRebuild()
|
||||||
|
},
|
||||||
|
socketInit() {
|
||||||
|
// Server settings are set on socket init
|
||||||
|
this.executeRebuild()
|
||||||
|
},
|
||||||
initListeners() {
|
initListeners() {
|
||||||
window.addEventListener('resize', this.windowResize)
|
window.addEventListener('resize', this.windowResize)
|
||||||
|
|
||||||
@ -480,7 +487,7 @@ export default {
|
|||||||
|
|
||||||
this.$eventBus.$on('bookshelf-clear-selection', this.clearSelectedEntities)
|
this.$eventBus.$on('bookshelf-clear-selection', this.clearSelectedEntities)
|
||||||
this.$eventBus.$on('bookshelf-select-all', this.selectAllEntities)
|
this.$eventBus.$on('bookshelf-select-all', this.selectAllEntities)
|
||||||
this.$eventBus.$on('bookshelf-keyword-filter', this.updateKeywordFilter)
|
this.$eventBus.$on('socket_init', this.socketInit)
|
||||||
|
|
||||||
this.$store.commit('user/addSettingsListener', { id: 'lazy-bookshelf', meth: this.settingsUpdated })
|
this.$store.commit('user/addSettingsListener', { id: 'lazy-bookshelf', meth: this.settingsUpdated })
|
||||||
|
|
||||||
@ -502,7 +509,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$eventBus.$off('bookshelf-clear-selection', this.clearSelectedEntities)
|
this.$eventBus.$off('bookshelf-clear-selection', this.clearSelectedEntities)
|
||||||
this.$eventBus.$off('bookshelf-select-all', this.selectAllEntities)
|
this.$eventBus.$off('bookshelf-select-all', this.selectAllEntities)
|
||||||
this.$eventBus.$off('bookshelf-keyword-filter', this.updateKeywordFilter)
|
this.$eventBus.$off('socket_init', this.socketInit)
|
||||||
|
|
||||||
this.$store.commit('user/removeSettingsListener', 'lazy-bookshelf')
|
this.$store.commit('user/removeSettingsListener', 'lazy-bookshelf')
|
||||||
|
|
||||||
@ -534,7 +541,7 @@ export default {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (window.innerWidth > 0 && window.innerWidth !== this.mountWindowWidth) {
|
if (window.innerWidth > 0 && window.innerWidth !== this.mountWindowWidth) {
|
||||||
console.log('Updated window width', window.innerWidth, 'from', this.mountWindowWidth)
|
console.log('Updated window width', window.innerWidth, 'from', this.mountWindowWidth)
|
||||||
this.rebuild()
|
this.executeRebuild()
|
||||||
}
|
}
|
||||||
}, 50)
|
}, 50)
|
||||||
},
|
},
|
||||||
|
@ -126,6 +126,8 @@ export default {
|
|||||||
this.$store.commit('users/updateUser', user)
|
this.$store.commit('users/updateUser', user)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$eventBus.$emit('socket_init')
|
||||||
},
|
},
|
||||||
streamOpen(stream) {
|
streamOpen(stream) {
|
||||||
if (this.$refs.streamContainer) this.$refs.streamContainer.streamOpen(stream)
|
if (this.$refs.streamContainer) this.$refs.streamContainer.streamOpen(stream)
|
||||||
|
Loading…
Reference in New Issue
Block a user