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

[🐛] Best Practices for handling multiple channels on the same screen #2824

Open
8 tasks
arekkubaczkowski opened this issue Dec 4, 2024 · 0 comments
Open
8 tasks

Comments

@arekkubaczkowski
Copy link

Issue

In our application, we currently display multiple channels on the same screen. To achieve this, we are:

  1. Using Separate “Chat” Component Instances: We found that each channel requires its own instance of the Chat component. Without separate instances, we encountered issues where messages from one channel would incorrectly display in another channel’s chat UI. While this setup works, we are unsure if it’s the recommended or most efficient solution.
  2. Calling channel.watch() for each Channel: Each channel on the screen has its own watch() call to listen for updates. However, we are unsure if this approach is optimal or could potentially cause performance or synchronization issues when multiple channels are active simultaneously.
  3. Accessing Channel Instances Across the App: Beyond displaying messages on the UI, we also use channel instances to handle various types of events in different parts of the application. This raises further questions about the implications of managing multiple channel instances. For example:
    • Is there a recommended way to keep channel instances globally accessible while ensuring they remain properly synchronized?
    • How can we avoid conflicts or issues when the same channel is accessed and managed from different parts of the app?

Could you clarify if this is the correct approach for managing multiple channels on the same screen? Are there any best practices or alternative solutions we should consider to ensure proper functionality and performance?

We would greatly appreciate your guidance on this matter!

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
    etc...

Expected behavior

Project Related Information

Customization

Click To Expand

# N/A

Offline support

  • I have enabled offline support.
  • The feature I'm having does not occur when offline support is disabled. (stripe out if not applicable)

Environment

Click To Expand

package.json:

# N/A

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • stream-chat-react-native version you're using that has this issue:
    • e.g. 5.4.3
  • Device/Emulator info:
    • I am using a physical device
    • OS version: e.g. Android 10
    • Device/Emulator: e.g. iPhone 11

Additional context

Screenshots

Click To Expand


@arekkubaczkowski arekkubaczkowski changed the title [🐛] Best Practices for Handling Multiple Channels on the Same Screen [🐛] Best Practices for handling multiple channels on the same Screen Dec 4, 2024
@arekkubaczkowski arekkubaczkowski changed the title [🐛] Best Practices for handling multiple channels on the same Screen [🐛] Best Practices for handling multiple channels on the same screen Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant