fix: Clean up channel connection logic#1845
Open
EmmaSimon wants to merge 2 commits into
Open
Conversation
1ac3f61 to
2cc7f33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ticket: Identify persistent shimmer loading on launch root cause
This hopefully fixes the infinite loading issues for good. It seems like it was a combination of a few factors coming together.
Ultimately, the root cause was a race condition where the channel disconnect would sometimes be called right after the connect. We were also calling disconnect unnecessarily multiple times, partly because were using
DisposableEffect, which was complicating the disconnect calls.Now, we only call a single channel detach within the channel owner and the mutex before attempting to make a new connection, and we wait for the disconnection to complete before starting the new channel attach. All the
DisposableEffectblocks are also changed to basicLaunchedEffectwhich clear existing data if the relevant params have changed, and connect on active and disconnect on inactive. This seems to be more reliable when backgrounding and changing pages.iOS
- [ ] If you added any user-facing strings on iOS, are they included in Localizable.xcstrings?- [ ] Add temporary machine translations, marked "Needs Review"android
- [ ] All user-facing strings added to strings resource in alphabetical order- [ ] Expensive calculations are run inwithContext(Dispatchers.Default)where possible (ideally in shared code)Testing
Verified the correct behavior on Android and iOS, updated existing tests to pass, and could not reproduce the infinite loading issue after these changes.