Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple channel lists with 100+ channel members #2019

Open
mishkeTz opened this issue Mar 20, 2023 · 10 comments
Open

Multiple channel lists with 100+ channel members #2019

mishkeTz opened this issue Mar 20, 2023 · 10 comments
Labels
Awaiting API Improvement Waiting for BE implementation Needs Triaging

Comments

@mishkeTz
Copy link

mishkeTz commented Mar 20, 2023

There was a new version that introduced support for the new prop channelRenderFilterFn that can be used to add the last step of filtering of channels that should be displayed in the list.

In my case, we have two channel lists that we display on two different screens, and in some cases the group from channel list B would end up in channel list A and vice versa.

Quote from another issue I created #1945

My question for this is because it seems that when there are multiple channel lists i.e. A and B, and when the user sends the message from the channel (list A) then the channel also appears in channel list B, and none of the events handles gets called but the channel just gets added.


To fix this issue I used channelRenderFilterFn to add filtering and check if the user is actually a member of that channel or not to have the correct list of channels that are displayed to the user. However, this doesn't work in cases when the group has over 100+ members, because we don't get the full list of members on the channel and the condition check will fail.

channelRenderFilterFn={(channels) => { return channels?.filter(({ state: { members = [] } = {} }) => Object.keys(members)?.includes(userId)); }}


The members limit of 100 also makes some other places or features that we want to have on the app difficult...

Is there a way to get the whole list of members or in this case another way to achieve this check?
This all comes to issues when there is an integration of two channel lists in the app...

@vanGalilea
Copy link
Contributor

Might be related to a stale state, we will have a look at it @mishkeTz thanks

@mishkeTz
Copy link
Author

mishkeTz commented Apr 5, 2023

Is there any update on this? Will there be a solution to this problem, we are experiencing problems where we have two channel lists with different filters, and due to this issue mentioned above where we have to use channelRenderFilterFn which doesn't work with our condition as we only get 100 channel members back.

@vanGalilea Any updates regarding this on your side? Did you prioritize this topic? Is there a way for me to implement a fix for this on my side?

@vishalnarkhede
Copy link
Contributor

@mishkeTz This is indeed a limitation of chat api at the moment.

Could you tell me more about the product requirements around multiple channel lists? What is channel list A and B? Or what are the filters exactly. Maybe I can suggest some alternative solution.

@vishalnarkhede vishalnarkhede added the Awaiting API Improvement Waiting for BE implementation label Sep 22, 2023
@mishkeTz
Copy link
Author

Hi, sprry for the late response.
Generally the use case is to have channel list rendered on two separate screens with their own list of channels

I.e. there one screen where we want to render only 1on1 channels (channel/chat for two users) and then on another screen we want to render groups to which users can join to.
Now this is making a lot of problems, because it seems that the package is built in a way that it can handle only one instance of the channel rendering screen.

If you have a use-case with two screens and two different lists of channels then the results are mixed and when someone sends a message in one channel it appears in another list of channels.

Screen A:

  • render all channels where type is channel_messaging

Screen B:

  • render all channels where type is channel_group

@softwarebyze
Copy link

Generally the use case is to have channel list rendered on two separate screens with their own list of channels

I.e. there one screen where we want to render only 1on1 channels (channel/chat for two users) and then on another screen we want to render groups to which users can join to.
Now this is making a lot of problems, because it seems that the package is built in a way that it can handle only one instance of the channel rendering screen.

If you have a use-case with two screens and two different lists of channels then the results are mixed and when someone sends a message in one channel it appears in another list of channels.

Screen A:

  • render all channels where type is channel_messaging

Screen B:

  • render all channels where type is channel_group

I am running into this same exact problem, same use case

@YonahAFeld
Copy link

YonahAFeld commented Nov 13, 2024

Same issue. @vishalnarkhede @vanGalilea This is causing us to have to redesign our app. Can we get this looked at again?

@khushal87
Copy link
Member

Hey @mishkeTz, so your bigger problem is that when a message is sent from one channel list, the channel appears on top of the other channel list as well, even if they don't match the filters, right? This is a known problem but once you confirm your issue I can guide you through how to fix it.

In the cases where you initially load the channels on the channel list, do they respect the filters, or even then, they don't? Technically, if your filters are correct, they should respect.

@mishkeTz
Copy link
Author

Hi @khushal87,
Yes that's correct. But I don't think that's the only issue (when the new message is sent).

There are at least two more cases:

  1. Because the users can create channels as well, when they create a new channel it also appears in both channel lists.
  2. The users can join the channel themself or another user can add you to the channel as well. Then it can also happen that the channel appears for you in both channel lists.

@khushal87
Copy link
Member

khushal87 commented Nov 14, 2024

Hey @mishkeTz, so the thing is, we have recently added a note on our ChannelList docs that addresses the same concern. These new channels that are added to the list when you receive a new message, a member is added to a channel, etc, are not filtered by our backend or by us. This is because of the following concerns:

- When receiving channel information from channel events, the filters are not respected; the reason for this is that channel filters can get very complex, and implementing that filtering logic that supports all of the custom filters would be very hard to do. 
- Implementing this on the backend side isn’t an option as it is inefficient and has to cater to different filters.

So, to help you with it, you will have to override the notification.message_new event using the onNewMessageNotification and message.new event handlers using the onNewMessage prop of the ChannelList component and similarly for other events that you can read through the docs here. Its very easy to listen to events and filter the data as per your requirements.

Note: In your case, you will have to do it for both Channel lists.

@softwarebyze
Copy link

thank you for the suggestion, @khushal87. Could you please give an example code snippet of how to implement the overrides?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting API Improvement Waiting for BE implementation Needs Triaging
Projects
None yet
Development

No branches or pull requests

6 participants