onChannelChanged returns wrong unreadMessageCount

Hi, I was using the onChannelChanged event to get the latest unreadMessageCount from the channel object and display it on our UI. I noticed if I delete the last read message, the unreadMessageCount will be decremented by 1, which shouldn’t happen.

Here’s an example, let’s say we have a total of 5 messages and 2 of them are unread:

  • message_1 (read)
  • message_2 (read)
  • message_3 (read) - last read
  • message_4 (unread)
  • message_5 (unread)

When I delete either message_1 OR message_2, the unreadMessageCount remains as 2, which is correct.
When I delete either message_4 OR message_5, the unreadMessageCount gets decremented by 1, which is also correct since they are part of the unread messages.
But when I delete message_3 (last read), the unreadMessageCount got incorrectly decremented by 1. Supposedly it should remain as 2, because message_4 and message_5 are still unread.

For your information:

  • I performed the message deletion from the dashboard as our app doesn’t support deleting message yet
  • I did not call markAsRead in between the message deletions

Hi @hewong,

We will run some tests on our end and let you know of our findings. Meanwhile, if you have any other questions please let us know.

Best,
Dhaval.

Hi @hewong,

I was able to reproduce the issue and have notified our engineering team regarding this. I will keep you updated on the progress, Meanwhile, if you have any other questions please let us know.

Best,
Dhaval.

Alright thanks for the update!