You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've made a small change to your demo app which shows how to reproduce the issue. Run demo app, select a channel from the list, tap Back, tap the "Break" toolbar button, then try to select a channel. You can see the channel row highlight (as expected) when you tap it, but the app doesn't navigate to the selected channel.
What did you expect to happen?
I expect that tapping a channel in the list will always navigate to the selected channel, even if the view which embeds the ChatChannelListView updates (re-revaluates its body for some reason).
What happened instead?
You can still select a channel in the list, but the app won't navigate to that channel.
Device:
Fails on the iPhone 16 Pro Simulator as well as on devices running iOS 17 and 18.
Additional context
We have an app where we've embedded the ChatChannelListView in a "Chat" tab alongside our other functionality, but when something else in our app causes a higher-level view update, the user can no longer navigate to channels in the Chat tab.
I've confirmed that the selected channel is changing (the view model updates), but the Binding that propagates that change downward to the NavigationLink appears to stop working.
The text was updated successfully, but these errors were encountered:
Thank you for creating this issue. I have reviewed it and I will need to do changes to the SDK for making this to work. The core problem is that the default onTapItem captures the view model instances created in the view's init, not the one stored by the @StateObject.
There is a workaround which is to add .id(isBroken) (or any other custom view identity which is derived from the internal state) to theChatChannelListView for forcing SwiftUI to create a brand new view and therefore updating @StateObject stored view model.
I'll create an internal issue and include a fix for the next release. We will update this issue when a new version has been released. For now, feel free to use the workaround.
What did you do?
See commit lukeadamson@8bd7df2 of fork https://github.com/lukeadamson/stream-chat-swiftui
I've made a small change to your demo app which shows how to reproduce the issue. Run demo app, select a channel from the list, tap Back, tap the "Break" toolbar button, then try to select a channel. You can see the channel row highlight (as expected) when you tap it, but the app doesn't navigate to the selected channel.
What did you expect to happen?
I expect that tapping a channel in the list will always navigate to the selected channel, even if the view which embeds the ChatChannelListView updates (re-revaluates its body for some reason).
What happened instead?
You can still select a channel in the list, but the app won't navigate to that channel.
GetStream Environment
GetStream Chat version:
See fork.
GetStream Chat frameworks: StreamChat, StreamChatSwiftUI
iOS version:
Reproduced on iOS 17 and 18
Swift version:
Default included with Xcode 16.0
Xcode version:
Xcode 16.0
Device:
Fails on the iPhone 16 Pro Simulator as well as on devices running iOS 17 and 18.
Additional context
We have an app where we've embedded the ChatChannelListView in a "Chat" tab alongside our other functionality, but when something else in our app causes a higher-level view update, the user can no longer navigate to channels in the Chat tab.
I've confirmed that the selected channel is changing (the view model updates), but the Binding that propagates that change downward to the NavigationLink appears to stop working.
The text was updated successfully, but these errors were encountered: