stream-chat-react
stream-chat-react copied to clipboard
feat: Marking messages as read does not correctly update the unread count in Preview
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
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
reconnecting to chat will bring in the correct unread count
Package version
- stream-chat-react: 8.0.0
- stream-chat-css: n/a
- stream-chat-js: 6.5.1 (stream-chat)
@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.
@jpsierens88 as there are few customizations including the unread counter and red dot indicator, could you please add the following info:
- where unread count is taken in you channel preview component?
- what flag does your red dot use to be conditionally rendered?
Thank you
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
This issue is actually a new feature not yet supported by the SDK.