stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

feat: Marking messages as read does not correctly update the unread count in Preview

Open jpsierens88 opened this issue 2 years ago • 4 comments

Describe the bug

calling mark_read(user_id, { message_id: message_id }) (ruby) in the BE marks the whole channel as read, even if there's other new messages that havent been read. reconnecting the chat shows the correct unread count

To Reproduce

  • have a ChannelList component, with a Preview component that shows the unread count
  • send a couple of messages to the channel, the unread counter should update
  • in the BE, mark one of the messages as read

Expected behavior

The Preview should show the correct unread message count

Screenshots sending new messages image marking 1 of the messages as read in the BE with mark_read(user_id, { message_id: message_id }) will mark all the channel as read image reconnecting to chat will bring in the correct unread count image

Package version

  • stream-chat-react: 8.0.0
  • stream-chat-css: n/a
  • stream-chat-js: 6.5.1 (stream-chat)

jpsierens88 avatar May 11 '22 19:05 jpsierens88

@jpsierens88 Thank you for reporting this problem. I was able to reproduce it and will fix it. At the moment I do not have ETA.

MartinCupela avatar May 18 '22 12:05 MartinCupela

@jpsierens88 as there are few customizations including the unread counter and red dot indicator, could you please add the following info:

  1. where unread count is taken in you channel preview component?
  2. what flag does your red dot use to be conditionally rendered?

Thank you

MartinCupela avatar May 19 '22 13:05 MartinCupela

hi @MartinCupela, our custom channel preview component just uses the unread prop which comes from stream-chat-reacts ChannelPreview (source)

both unread count and flag use a unread >= 1 condition to show

I think the main problem comes from the stream-chat-react ChannelPreview. It's resetting the unread count whenever a notification.mark_read event fires

jpsierens88 avatar May 19 '22 15:05 jpsierens88

This issue is actually a new feature not yet supported by the SDK.

MartinCupela avatar Sep 13 '22 08:09 MartinCupela