bug: The pinnedMessages data in useChannelStateContext does not represent the most recently pinned messages.
Describe the bug
When I log the pinnedMessages data from useChannelStateContext, it only returns the first 10 pinned messages.
To Reproduce
Steps to reproduce the behavior:
When I log the pinnedMessages from useChannelStateContext(), it only returns the first 10 pinned messages (seemingly the oldest ones). const { pinnedMessages } = useChannelStateContext(); console.log(pinnedMessages, 'pinnedMessages')
However, when I use channel.getPinnedMessages({ limit, offset }, { pinned_at: -1 }), I can fetch a longer list, and it's ordered by the most recently pinned messages (pinned_at descending). const pinedMessagesOtherPage = await channel.getPinnedMessages({ limit, offset: offset }, { pinned_at: -1 }); console.log('pinedMessagesOtherPage', pinedMessagesOtherPage.messages);
Expected behavior
I would like pinnedMessages from useChannelStateContext() to reflect the same behavior — i.e., return the latest pinned messages, ideally ordered by pinned_at descending.
Screenshots pinnedMessages from useChannelStateContext() https://drive.google.com/file/d/1cDQf9bkAIFKs-6hqi18v4Zivh6bmuY1Q/view?usp=sharing
channel.getPinnedMessages https://drive.google.com/file/d/1nUpT7kIIvoLILuM0YdZrLCUh55M6HjU3/view?usp=sharing
Package version
- stream-chat-react: 12.13.1
- stream-chat-css: 5.7.2
- stream-chat-js: 8.57.6
Hello @nganhuynh2002, those 10 pinned messages will probably be the first 10 messages you get with channel query. If you want to paginate pinned messages, then you need to use getPinnedMessages.
Feel free to describe your usecase - what you plan to do with the pinned messages array.
Hello @MartinCupela, Thank you so much for the clarification!