Skip to content

Commit

Permalink
Merge pull request #522 from GetStream/fix-ready-by-reference
Browse files Browse the repository at this point in the history
fix: don't change readBy array reference on message.read event
  • Loading branch information
szuperaz authored Dec 15, 2023
2 parents 38d2577 + a591989 commit d2de4ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/stream-chat-angular/src/lib/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,12 @@ export class ChannelService<
if (!latestMessage || !e.user) {
return;
}
latestMessage.readBy = getReadBy(latestMessage, channel);
if (latestMessage.readBy) {
latestMessage.readBy.splice(0, latestMessage.readBy.length);
} else {
latestMessage.readBy = [];
}
latestMessage.readBy.push(...getReadBy(latestMessage, channel));
messages[messages.length - 1] = { ...latestMessage };

this.activeChannelMessagesSubject.next([...messages]);
Expand Down

0 comments on commit d2de4ed

Please sign in to comment.