50
50
:theme =" theme"
51
51
:styles =" styles"
52
52
:current-user-id =" currentUserId"
53
- :rooms =" loadingRooms ? [] : rooms "
53
+ :rooms =" loadedRooms "
54
54
:loading-rooms =" loadingRooms"
55
55
:messages =" messages"
56
56
:messages-loaded =" messagesLoaded"
@@ -104,6 +104,7 @@ export default {
104
104
loadingRooms: true ,
105
105
allUsers: [],
106
106
loadingLastMessageByRoom: 0 ,
107
+ roomsLoadedCount: false ,
107
108
selectedRoom: null ,
108
109
messagesPerPage: 20 ,
109
110
messages: [],
@@ -141,10 +142,17 @@ export default {
141
142
this .resetRooms ()
142
143
},
143
144
145
+ computed: {
146
+ loadedRooms () {
147
+ return this .rooms .slice (0 , this .roomsLoadedCount )
148
+ }
149
+ },
150
+
144
151
methods: {
145
152
resetRooms () {
146
153
this .loadingRooms = true
147
154
this .loadingLastMessageByRoom = 0
155
+ this .roomsLoadedCount = 0
148
156
this .rooms = []
149
157
this .roomsLoaded = false
150
158
this .startRooms = null
@@ -248,7 +256,10 @@ export default {
248
256
this .rooms = this .rooms .concat (formattedRooms)
249
257
formattedRooms .map (room => this .listenLastMessage (room))
250
258
251
- if (! this .rooms .length ) this .loadingRooms = false
259
+ if (! this .rooms .length ) {
260
+ this .loadingRooms = false
261
+ this .roomsLoadedCount = 0
262
+ }
252
263
253
264
this .listenUsersOnlineStatus (formattedRooms)
254
265
this .listenRoomsTypingUsers (query)
@@ -274,6 +285,7 @@ export default {
274
285
275
286
if (this .loadingLastMessageByRoom === this .rooms .length ) {
276
287
this .loadingRooms = false
288
+ this .roomsLoadedCount = this .rooms .length
277
289
}
278
290
}
279
291
})
0 commit comments