stream-chat-react
stream-chat-react copied to clipboard
bug: multiple channels open with channel list causes re-render
Describe the bug
While using the channel list, if you render a separate channel component that isn't the "active channel", something as part of the channel list render causes those channel components to re-render and the context/hover menu to be blank with missing icons.
To Reproduce
Steps to reproduce the behavior:
- Load a page with a channel component where the channel is passed in manually
- Open / cause the channel list to render
- You will see the channel components re-render/flash
- Hover over a message and you will see missing context actions.
Expected behavior
Rendering the channel list alongside a channel component that is not controlled via the active channel (i.e channel prop passed in) shouldn't cause side effects.
Package version
- stream-chat-react: 9.2.0
- stream-chat: 6.7.3
Additional context
Our goal is to use the channel list as is, with the sorting, unread indicators etc but be able to render multiple channels on a page without issue.
Is there a way to use the channel list component purely as a list of channels, and manually setup each channel component where needed without it being linked to an 'active channel' or affected by the channel list context?
Hi,
the current component architecture is more or less coupled through contexts, so the re-render you describe is not something we can realistically address without deep architectural changes.
Re-renders however are usually relatively fast and should not be visible to the user unless there's an unmount/remount. Can you try to reproduce the problem using this sandbox? We will look and see if there's anything we can do to help you.
Closing for now as author of the issue did not provide any more context.