GetStream / stream-chat-swiftui

SwiftUI Chat SDK ➜ Stream Chat πŸ’¬
https://getstream.io/chat/sdk/swiftui/
Other
342 stars 84 forks source link

Channel was sometimes not selected when setting selectedChannelId #611

Closed laevandus closed 3 days ago

laevandus commented 6 days ago

πŸ”— Issue Link

Resolves: PBE-6078

🎯 Goal

Fix an issue where creating the channel list view with selectedChannelId set to a channel created a moments ago, did not select it.

πŸ›  Implementation

If there are integrations where a separate backend is used for creating channels and API responses contain cids, then immediately creating a channel list view and setting the selected id might fail. SDK needs to receive a web-socket event which triggers channel list change (calling synchronize can be too soon as well). Therefore, this PR changes the way how we try to set selected channel to waiting channel list updates instead. Moreover, it clarifies that the selectedChannelId method only works for loaded channels and it might be better to use ChannelViewScreen instead when it is certain that the channel is not part of the loaded list.

πŸ§ͺ Testing

Since the issue is around timing with other backend APIs, it is hard to manually test.

β˜‘οΈ Checklist

Stream-SDK-Bot commented 6 days ago

SDK Size

title develop branch diff status
StreamChatSwiftUI 7.14 MB 7.14 MB +1 KB 🟒
sonarcloud[bot] commented 3 days ago

Quality Gate Passed Quality Gate passed

Issues
86 New issues
0 Accepted issues

Measures
0 Security Hotspots
71.2% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud