Skip to content

Commit

Permalink
fix(MessagesList): cycle through only existing group keys when soft u…
Browse files Browse the repository at this point in the history
…pdating

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Mar 20, 2024
1 parent 331d175 commit ccc48df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ export default {
},

softUpdateAuthorGroups(oldGroups, newGroups, dateTimestamp) {
const oldKeys = Object.keys(oldGroups)
Object.entries(newGroups).forEach(([id, newGroup]) => {
if (!oldGroups[id]) {
const oldId = oldKeys.find(key => id < key && oldGroups[key].nextMessageId <= newGroup.nextMessageId)
const oldId = Object.keys(oldGroups)
.find(key => id < key && oldGroups[key].nextMessageId <= newGroup.nextMessageId)
if (oldId) {
// newGroup includes oldGroup and more old messages, remove oldGroup
delete this.messagesGroupedByDateByAuthor[dateTimestamp][oldId]
Expand Down

0 comments on commit ccc48df

Please sign in to comment.