vue-advanced-chat: bug: didn't load more messages when messagesLoaded once set to true
fetchMessage(data) {
console.log(data)
if (data.options) {
this.messagesLoaded = false
this.messages = []
data.room.unreadCount = 0
this.selectedRoom = data.room
db.set("rooms", this.rooms).write()
const muted = (data.room.roomId < 0 && this.muteAllGroups && !data.room.unmute) ||
(data.room.roomId < 0 && !this.muteAllGroups && data.room.mute) ||
(data.room.roomId > 0 && data.room.mute)
this.menuActions.find(e => e.name == "mute").title = muted ? "Unmute Chat" : "Mute Chat"
this.menuActions.find(e => e.name == "pin").title = data.room.index ? "Unpin Chat" : "Pin Chat"
}
const msgs2add = db.get("messages." + data.room.roomId)
.dropRightWhile(e => this.messages.includes(e))
.takeRight(10).value()
if (msgs2add.length)
this.messages = [...msgs2add, ...this.messages]
else
this.messagesLoaded = true
},
Once I scrolled to the very top of a conversation, then switch to another room, then switch back. It just loaded the last 10 messages and doesn’t load more messages any more, Even I switch to other room which have more than 10 messages
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (8 by maintainers)
Yes the timeout is necessary to make the behaviour work properly.