stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

🔥[🐛] Multiple channel lists on the same screen receive new message regardless of filter

Open sjmorton123 opened this issue 1 year ago • 0 comments

Issue

When I have multiple ChannelList components rendered on the same screen with different channel filters applied and I receive a new message, I am getting that channel in my ChannelList even when the filter should be filtering it. When I pull to refresh the channel then dissapears.

Steps to reproduce

Steps to reproduce the behavior:

  1. Setup a user with 4 channels with custom attrbutes. 2 channels with ChildId = 'A' and 2 channels with ChildId = 'B'
  2. Render two ChannelList components on the same screen. One filtering on Child 'A' and one filtering on Child 'B'
  3. Send a message to one of the Child 'B' channels
  4. Notice that the Child 'A' filtered ChannelList receives a Child 'B' channel at the top.

Expected behavior

I would not expect channels outside the filter on my ChannelList to come into my list.

Project Related Information

Customization

Click To Expand

    <View style={styles.container}>
      {children.map((child) => {
        const filters = {
          members: {
            '$in': [currentUserId ?? ''],
          },
          childId: child.ChildId,
        };
        return <ChannelList
          key={child.ChildId}
          ListHeaderComponent={() =>  <ChannelListHeader child={child} />}
          filters={filters}
          onSelect={(channel) => {
            dispatch(setActiveChannel(channel));
            navigation.navigate('ChannelScreen');
          }}
          PreviewAvatar={({ channel }) =>  <ChannelListItemAvatar channel={channel} />}
          sort={{
            last_message_at: -1,
          }}
        />;
      })}
    </View>

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:

"react-native": "0.68.6",
"stream-chat": "^8.36.0",
"stream-chat-react-native": "^5.32.1",

react-native info output:

info Fetching system and libraries information...
System:
    OS: macOS 13.5.1
    CPU: (10) x64 Apple M1 Pro
    Memory: 26.70 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.13.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.6 - /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.6 => 0.68.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
  • Platform that you're experiencing the issue on:
    • [] iOS
    • [ ] Android
    • [x] 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.32.1
  • Device/Emulator info:
    • [ ] I am using a physical device
    • OS version: iOS 16.2
    • Device/Emulator: IPhone 14

Additional context

Screenshots

Click To Expand

https://github.com/user-attachments/assets/503e273a-679c-4e2b-a2f0-45498fa4d315


sjmorton123 avatar Jul 18 '24 14:07 sjmorton123