Skip to content

Commit 0f5792b

Browse files
committed
limit elements inside the message list
1 parent 2879810 commit 0f5792b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

projects/stream-chat-angular/src/lib/channel.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,12 @@ export class ChannelService<
499499
this.watchForActiveChannelEvents(channel);
500500
this.addChannel(channel);
501501
this.activeChannelSubject.next(channel);
502+
const channelStateLength = channel.state.latestMessages.length;
503+
if (channelStateLength > 2 * this.messagePageSize) {
504+
channel.state.latestMessages = channel.state.latestMessages.slice(
505+
channelStateLength - 2 * this.messagePageSize
506+
);
507+
}
502508
this.setChannelState(channel);
503509
}
504510

0 commit comments

Comments
 (0)