Fix:Playlist tab not shown after adding first playlist #1092

This commit is contained in:
advplyr 2024-03-03 13:29:58 -06:00
parent c04c7a55d9
commit da3882fd5e
3 changed files with 10 additions and 8 deletions

View file

@ -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() {

View file

@ -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)
}
},

View file

@ -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) => {