Skip to content

Commit 07aea71

Browse files
committed
(demo) fetch more rooms only if necessary
1 parent 8470c00 commit 07aea71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

demo/src/ChatContainer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default {
154154
this.loadingLastMessageByRoom = 0
155155
this.roomsLoadedCount = 0
156156
this.rooms = []
157-
this.roomsLoaded = false
157+
this.roomsLoaded = true
158158
this.startRooms = null
159159
this.endRooms = null
160160
this.roomsListeners.forEach(listener => listener())
@@ -189,7 +189,7 @@ export default {
189189
const rooms = await query.get()
190190
// this.incrementDbCounter('Fetch Rooms', rooms.size)
191191
192-
if (rooms.empty) this.roomsLoaded = true
192+
this.roomsLoaded = rooms.empty || rooms.size < this.roomsPerPage
193193
194194
if (this.startRooms) this.endRooms = this.startRooms
195195
this.startRooms = rooms.docs[rooms.docs.length - 1]

0 commit comments

Comments
 (0)