GetStream / stream-chat-react

React Chat SDK ➜ Stream Chat 💬
https://getstream.io/chat/sdk/react/
Other
698 stars 272 forks source link

bug: jumpToFirstUnreadMessage doesn't work #2477

Open pieralukasz opened 3 weeks ago

pieralukasz commented 3 weeks ago

In VirtualizedMessageList jumpToFirstUnreadMessage from useChannelActionContext doesn't work as expected. Read object from useChannelStateContext is not updating properly, unread_messages property still increases and never clears.

const { channel, read } = useChannelStateContext<Chat.StreamChatGenerics>();
const { jumpToFirstUnreadMessage } = useChannelActionContext<Chat.StreamChatGenerics>();

Also value first_unread_message_id is undefined all the time, even when "New Message!" button is visible.

doc: https://getstream.io/chat/docs/sdk/react/guides/channel_read_state/

Expected behavior

Should scroll to last message, read object should properly update.

Package version

Desktop (please complete the following information):

Additional context

Also, is it any chance to change scroll position instead of scrolling to the middle? I want to scroll to and show last user unread message on top of the chat.

Greetings :)

MartinCupela commented 3 weeks ago

Hey @pieralukasz , could you please provide us with a minimum repro in a forked sandbox, so that we can better understand the level of customization? Thank you