fix: do not mutate update object reference

This commit is contained in:
Adhiraj Singh
2022-01-20 12:28:56 +05:30
parent c4eea6fd69
commit 284c7e7812

View File

@@ -117,9 +117,10 @@ export default (
chats.upsert(...newChats)
})
ev.on('chats.update', updates => {
for(const update of updates) {
for(let update of updates) {
const result = chats.update(update.id!, chat => {
if(update.unreadCount > 0) {
update = { ...update }
update.unreadCount = chat.unreadCount + update.unreadCount
}