Skip to content

Commit e4f353f

Browse files
committed
fix linting, add more logs
1 parent 404803c commit e4f353f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

projects/stream-chat-angular/src/lib/message-list/message-list.component.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class MessageListComponent
127127
this.channelService.activeChannel$.subscribe((channel) => {
128128
this.chatClientService.chatClient?.logger?.(
129129
'info',
130-
`${channel?.cid} selected`,
130+
`${channel?.cid || 'undefined'} selected`,
131131
{ tags: `message list ${this.mode}` }
132132
);
133133
if (this.channelId !== channel?.id) {
@@ -243,7 +243,7 @@ export class MessageListComponent
243243
}
244244
this.chatClientService.chatClient?.logger?.(
245245
'info',
246-
`Jumping to ${messageId}`,
246+
`Jumping to ${messageId || ''}`,
247247
{ tags: `message list ${this.mode}` }
248248
);
249249
if (messageId) {
@@ -479,9 +479,23 @@ export class MessageListComponent
479479
tap((messages) => {
480480
this.isLoading = false;
481481
if (messages.length === 0) {
482+
this.chatClientService.chatClient?.logger?.(
483+
'info',
484+
`Empty messages array, reseting scroll state`,
485+
{
486+
tags: `message list ${this.mode}`,
487+
}
488+
);
482489
this.resetScrollState();
483490
return;
484491
}
492+
this.chatClientService.chatClient?.logger?.(
493+
'info',
494+
`Received one or more messages`,
495+
{
496+
tags: `message list ${this.mode}`,
497+
}
498+
);
485499
const currentLatestMessage = messages[messages.length - 1];
486500
this.newMessageReceived(currentLatestMessage);
487501
const currentOldestMessage = messages[0];
@@ -590,6 +604,11 @@ export class MessageListComponent
590604
!this.latestMessage ||
591605
this.latestMessage.created_at?.getTime() < message.created_at.getTime()
592606
) {
607+
this.chatClientService.chatClient?.logger?.(
608+
'info',
609+
`Received new message`,
610+
{ tags: `message list ${this.mode}` }
611+
);
593612
this.latestMessage = message;
594613
this.hasNewMessages = true;
595614
this.isNewMessageSentByUser =

0 commit comments

Comments
 (0)