mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-09-08 10:51:46 +02:00
The item detail page already listens for the app-wide `library-changed` event and navigates away; the playlist and collection detail pages did not, so switching libraries left them showing stale content with no way back to the list. - playlist/_id.vue: route to /bookshelf/playlists on library change - collection/_id.vue: route to /bookshelf/collections unless the new library is the collection's own library
This commit is contained in:
@@ -135,8 +135,20 @@ export default {
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: nextBookNotRead.id })
|
||||
}
|
||||
}
|
||||
},
|
||||
libraryChanged(libraryId) {
|
||||
// A collection belongs to a single library, so leave this page when a different library is
|
||||
// selected rather than showing a collection that is not in the current library
|
||||
if (!libraryId || libraryId !== this.collection.libraryId) {
|
||||
this.$router.replace('/bookshelf/collections')
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {}
|
||||
mounted() {
|
||||
this.$eventBus.$on('library-changed', this.libraryChanged)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('library-changed', this.libraryChanged)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -162,13 +162,20 @@ export default {
|
||||
if (this.playlist.id === playlist.id) {
|
||||
this.$router.replace('/bookshelf/playlists')
|
||||
}
|
||||
},
|
||||
libraryChanged() {
|
||||
// Playlist contents are shown in the context of the selected library, so leave this page
|
||||
// when the library changes rather than showing stale items
|
||||
this.$router.replace('/bookshelf/playlists')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('library-changed', this.libraryChanged)
|
||||
this.$socket.$on('playlist_updated', this.playlistUpdated)
|
||||
this.$socket.$on('playlist_removed', this.playlistRemoved)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('library-changed', this.libraryChanged)
|
||||
this.$socket.$off('playlist_updated', this.playlistUpdated)
|
||||
this.$socket.$off('playlist_removed', this.playlistRemoved)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user