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

Fix Channel List stuck in Empty View State in rare conditions #639

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### 🐞 Fixed
- Fix crash when opening message overlay in iPad with a TabBar [#627](https://github.com/GetStream/stream-chat-swiftui/pull/627)
- Only show Leave Group option if the user has leave-channel permission [#633](https://github.com/GetStream/stream-chat-swiftui/pull/633)
- Fix Channel List stuck in Empty View State in rare conditions [#639](https://github.com/GetStream/stream-chat-swiftui/pull/639)

# [4.65.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.65.0)
_October 18, 2024_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController

updateChannels()

if channels.isEmpty {
loading = networkReachability.isNetworkAvailable()
}
Comment on lines -313 to -315
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinmitrevski I can probably revert this, since it is not related, but this means that for simulators, the loading view will never appear, and while doing development this can be annoying, especially because most devs initially use the simulator to test things.

Ideally, in the future we should try to follow the Thread List v2 approach, where when there is already a cache, and the data is loading, we show a loading spinner in the header view. As well, as a loading spinner on the footer view when loading more data. (This useful especially in low network conditions)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not update this logic for simulators only? (Keep everything as is for regular devices)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is going to complicate the code IMO. I think we should align this with UIKit, besides that it is usually not a good practice using network reachability for things that can potentially block user interaction 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, if it's this way on UIKit, let's keep it like this.

loading = channels.isEmpty

controller?.synchronize { [weak self] error in
guard let self = self else { return }
Expand All @@ -322,9 +320,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
self.channelAlertType = .error
} else {
// access channels
if self.selectedChannel == nil {
self.updateChannels()
}
self.updateChannels()
self.checkForDeeplinks()
}
}
Expand Down
Loading