From 61e5788525bbbec2da43b1f8b986f45fa556d32d Mon Sep 17 00:00:00 2001 From: antoine92190 Date: Tue, 1 Dec 2020 00:54:16 +0100 Subject: [PATCH] (fix) loading with showRoomsList --- src/ChatWindow/ChatWindow.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ChatWindow/ChatWindow.vue b/src/ChatWindow/ChatWindow.vue index 9498b2ab..9ca37095 100644 --- a/src/ChatWindow/ChatWindow.vue +++ b/src/ChatWindow/ChatWindow.vue @@ -127,12 +127,6 @@ 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) @@ -140,7 +134,11 @@ export default { 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 }) @@ -153,6 +151,10 @@ export default { } }, + loadingRooms(val) { + if (val) this.room = {} + }, + roomId: { immediate: true, handler(val) {