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

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Nov 4, 2024

🔗 Issue Link

Resolves https://stream-io.atlassian.net/browse/PBE-6291

🎯 Goal

Fix the Channel List stuck in Empty View State in rare conditions.

🛠 Implementation

  • Fix the Channel List stuck in Empty View State in rare conditions. When a customer selected a channel, before opening the channel, the empty view would not disappear.
  • Fixes the loading view not showing in rare scenarios, like in the simulator, since the NetworkReachibility won't work well in the simulator. Either way, the loading view should only depend on whether there is an available local cache or not, not if there is a network available since this could cause unpredictable behaviour.

🧪 Testing

N/A. Not really testable in the Demo App, but the customer confirmed the solution works.

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@nuno-vieira nuno-vieira added the bug Something isn't working label Nov 4, 2024
@nuno-vieira nuno-vieira requested a review from a team as a code owner November 4, 2024 20:05
Comment on lines -313 to -315
if channels.isEmpty {
loading = networkReachability.isNetworkAvailable()
}
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.

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Nov 4, 2024

SDK Size

title develop branch diff status
StreamChatSwiftUI 7.99 MB 7.99 MB -1 KB 🚀

Copy link

sonarcloud bot commented Nov 4, 2024

@nuno-vieira nuno-vieira merged commit 1ecdb67 into develop Nov 5, 2024
11 checks passed
@nuno-vieira nuno-vieira deleted the fix/channel-list-empty-view-not-disappearing branch November 5, 2024 12:40
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants