Merge pull request #2003 from ljlongwing/fix-1711-1712-library-switch

Leave playlist/collection detail pages when the library changes (#1711, #1712)
This commit is contained in:
advplyr
2026-09-07 17:20:56 -05:00
committed by GitHub
2 changed files with 20 additions and 1 deletions
+13 -1
View File
@@ -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>
+7
View File
@@ -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)
}