diff --git a/components/bookshelf/LazyBookshelf.vue b/components/bookshelf/LazyBookshelf.vue index 85697c92..cad31a21 100644 --- a/components/bookshelf/LazyBookshelf.vue +++ b/components/bookshelf/LazyBookshelf.vue @@ -79,7 +79,7 @@ export default { return this.page }, hasFilter() { - if (this.page === 'series' || this.page === 'collections') return false + if (this.page === 'series' || this.page === 'collections' || this.page === 'playlists') return false return this.filterBy !== 'all' }, orderBy() { diff --git a/layouts/default.vue b/layouts/default.vue index 29520470..45107c81 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -212,8 +212,7 @@ export default { } }, userUpdated(user) { - // console.log('[default] userUpdated:', JSON.stringify(user)) - if (this.user && this.user.id == user.id) { + if (this.user?.id == user.id) { this.$store.commit('user/setUser', user) } }, diff --git a/plugins/server.js b/plugins/server.js index cfd15a5d..257db320 100644 --- a/plugins/server.js +++ b/plugins/server.js @@ -48,11 +48,7 @@ class ServerSocket extends EventEmitter { this.socket.on('init', this.onInit.bind(this)) this.socket.on('user_updated', this.onUserUpdated.bind(this)) this.socket.on('user_item_progress_updated', this.onUserItemProgressUpdated.bind(this)) - - // Good for testing socket requests - // this.socket.onAny((evt, args) => { - // console.log(`[SOCKET] onAny: ${this.socket.id}: ${evt} ${JSON.stringify(args)}`) - // }) + this.socket.on('playlist_added', this.onPlaylistAdded.bind(this)) } removeListeners() { @@ -93,6 +89,13 @@ class ServerSocket extends EventEmitter { this.$store.commit('user/updateUserMediaProgress', payload.data) this.emit('user_media_progress_updated', payload) } + + onPlaylistAdded() { + // Currently numUserPlaylists is only used for showing the playlist tab or not. Precise number is not necessary + if (!this.$store.state.libraries.numUserPlaylists) { + this.$store.commit('libraries/setNumUserPlaylists', 1) + } + } } export default ({ app, store }, inject) => {