Skip to content

Commit d5ff6c8

Browse files
committed
(fix) find room by index to update online status
1 parent 071b6aa commit d5ff6c8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

demo/src/ChatContainer.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ export default {
529529
},
530530
531531
listenUsersOnlineStatus() {
532-
this.rooms.map((room, index) => {
532+
this.rooms.map(room => {
533533
room.users.map(user => {
534534
firebase
535535
.database()
@@ -559,7 +559,11 @@ export default {
559559
560560
user.status = { ...snapshot.val(), last_changed }
561561
562-
this.$set(this.rooms, index, room)
562+
const roomIndex = this.rooms.findIndex(
563+
r => room.roomId === r.roomId
564+
)
565+
566+
this.$set(this.rooms, roomIndex, room)
563567
}
564568
})
565569
})

0 commit comments

Comments
 (0)