-
Notifications
You must be signed in to change notification settings - Fork 90
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
How to update ChannelListView with a query? #586
Comments
Hi @hyqshr, Seems like you are not storing the created controllers anywhere - they are re-created every time your view's body is being re-evaluated, thus causing issues. If it's already created once, you should reuse it, e.g. keep it as a State, or somewhere outside the view. Additionally, if you filter by custom data, you should also provide a filter block, as described here: https://getstream.io/chat/docs/sdk/ios/client/controllers/channels/#filtering-with-extra-data. Hope that helps, |
Hi @martinmitrevski , Thank you for your help. I tried to create different controllers outside of the view like:
And then in chat view, I re-use the created controller based on type selection:
It still doesn't work, the channels list will be unclickable and the filter query is not working. Also when I try do
https://getstream.io/chat/docs/sdk/ios/client/controllers/channels/#filtering-with-extra-data |
@martinmitrevski Does this imply that for each filter you have inside the app (e.g. Unread, Group Chats, Teams) you should have a matching controller? Therefore if you have 5 filters in total, you should have 5 different controllers? |
What did you do?
I try to build a chat type filter so user click each type picker and I can update ChannelListView with the query result.
I tried to build a dynamic controller and pass to ChatChannelListView:
What did you expect to happen?
The ChannelListView correctly updated when user tap the picker.
What happened instead?
The screen freeze after tap the filter, can not open any chat afterward.
GetStream Environment
**GetStream Chat version:4.60.0
GetStream Chat frameworks: StreamChat, StreamChatSwiftUI
iOS version:
Swift version:
**Xcode version:15.4
**Device:Simulator iPhone 15 Pro
Additional context
The text was updated successfully, but these errors were encountered: