Skip to content

Commit

Permalink
(fix) loading with showRoomsList
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine92190 committed Nov 30, 2020
1 parent fbd2b30 commit 61e5788
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/ChatWindow/ChatWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,18 @@ export default {
rooms: {
immediate: true,
handler(newVal, oldVal) {
if (!this.loadFirstRoom) {
this.room = {}
this.showRoomsList = true
return
}
if (
!newVal[0] ||
!newVal.find(room => room.roomId === this.room.roomId)
) {
this.showRoomsList = true
}
if (newVal[0] && (!oldVal || newVal.length !== oldVal.length)) {
if (
this.loadFirstRoom &&
newVal[0] &&
(!oldVal || newVal.length !== oldVal.length)
) {
if (this.roomId) {
const room = newVal.find(r => r.roomId === this.roomId)
this.fetchRoom({ room })
Expand All @@ -153,6 +151,10 @@ export default {
}
},
loadingRooms(val) {
if (val) this.room = {}
},
roomId: {
immediate: true,
handler(val) {
Expand Down

0 comments on commit 61e5788

Please sign in to comment.