mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01: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) {
|
||||
this.resetEntities()
|
||||
} else if (settings.bookshelfCoverSize !== this.currentBookWidth) {
|
||||
this.rebuild()
|
||||
this.executeRebuild()
|
||||
}
|
||||
},
|
||||
scroll(e) {
|
||||
@ -461,12 +461,19 @@ export default {
|
||||
var lastBookIndex = Math.min(this.totalEntities, this.shelvesPerPage * this.entitiesPerShelf)
|
||||
this.mountEntites(0, lastBookIndex)
|
||||
},
|
||||
windowResize() {
|
||||
executeRebuild() {
|
||||
clearTimeout(this.resizeTimeout)
|
||||
this.resizeTimeout = setTimeout(() => {
|
||||
this.rebuild()
|
||||
}, 200)
|
||||
},
|
||||
windowResize() {
|
||||
this.executeRebuild()
|
||||
},
|
||||
socketInit() {
|
||||
// Server settings are set on socket init
|
||||
this.executeRebuild()
|
||||
},
|
||||
initListeners() {
|
||||
window.addEventListener('resize', this.windowResize)
|
||||
|
||||
@ -480,7 +487,7 @@ export default {
|
||||
|
||||
this.$eventBus.$on('bookshelf-clear-selection', this.clearSelectedEntities)
|
||||
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 })
|
||||
|
||||
@ -502,7 +509,7 @@ export default {
|
||||
}
|
||||
this.$eventBus.$off('bookshelf-clear-selection', this.clearSelectedEntities)
|
||||
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')
|
||||
|
||||
@ -534,7 +541,7 @@ export default {
|
||||
setTimeout(() => {
|
||||
if (window.innerWidth > 0 && window.innerWidth !== this.mountWindowWidth) {
|
||||
console.log('Updated window width', window.innerWidth, 'from', this.mountWindowWidth)
|
||||
this.rebuild()
|
||||
this.executeRebuild()
|
||||
}
|
||||
}, 50)
|
||||
},
|
||||
|
@ -126,6 +126,8 @@ export default {
|
||||
this.$store.commit('users/updateUser', user)
|
||||
})
|
||||
}
|
||||
|
||||
this.$eventBus.$emit('socket_init')
|
||||
},
|
||||
streamOpen(stream) {
|
||||
if (this.$refs.streamContainer) this.$refs.streamContainer.streamOpen(stream)
|
||||
|
Loading…
Reference in New Issue
Block a user