-
Notifications
You must be signed in to change notification settings - Fork 226
Remember flows #4533
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
Remember flows #4533
Conversation
…e underlined flow.
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4533 +/- ##
===========================================
+ Coverage 80.14% 80.16% +0.01%
===========================================
Files 2083 2082 -1
Lines 54902 54931 +29
Branches 6848 6847 -1
===========================================
+ Hits 43999 44033 +34
+ Misses 8543 8539 -4
+ Partials 2360 2359 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
"syncService.isOnline()", | ||
"userListDataStore.selectedUsers()", | ||
"accountProviderDataSource.flow()", | ||
"syncService.isOnline()", | ||
"timeline.paginationStatus", | ||
"analyticsService.getUserConsent()", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using an annotation to suppress the warning would be better, but I don't know if that's possible/easy. Just something we could keep in mind for future usages of Konsist.
@@ -73,4 +74,6 @@ class RustSyncService( | |||
} | |||
.distinctUntilChanged() | |||
.stateIn(sessionCoroutineScope, SharingStarted.Eagerly, SyncState.Idle) | |||
|
|||
override val isOnline: StateFlow<Boolean> = syncState.mapState { it != SyncState.Offline } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about our mapState
helper function 👀 .
Content
Ensure that Flows are not created again when a recomposition occurred. They should be remembered, except if they are hold in a val. So this PR:
remember
around flow function creatorfun
which return flow toval
, so that it's clear the the flow is not created at each usage.Motivation and context
Tiny performance improvement and Compose best practice.
Screenshots / GIFs
No expected change
Tests
Tested devices
Checklist