Repository navigation
Load the activity statistics through a ViewModel - #620
Open
greenart7c3 wants to merge 2 commits into
Open
greenart7c3 wants to merge 2 commits into
greenart7c3 wants to merge 2 commits into
Conversation
ActivityStatsCard read the history DAO itself. ActivityStatsViewModel now loads the accepted/rejected counts for the three windows once, the first time the card is opened, as the card did; the card leaves the databaseInUi allow-list and its LongMethod baseline entry. No behaviour change.
Review of #620: the card kept its counts in remember, so coming back to the screen loaded fresh ones; the ViewModel outlives that, and would have shown stale counts. forget() drops them (and cancels a load in flight) when the card is disposed.
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.
Step 6 of docs/architecture.md (keep
ui/off the database), second screen.ActivityStatsCard(on the activity screens, account-wide and per app) opened the history DAO itself. NowActivityStatsViewModeldoes:WindowStatsandloadStatsmove there unchangedThe card takes the ViewModel as a default argument (
viewModel(key, factory), as the ComposeViewModelInjectionrule wants) and only renders.Architecture allow-list −1 (
ActivityStatsCard), detekt baseline −1 (LongMethodfor the card), none added. NewActivityStatsViewModelTest: per-app vs account-wide counts, and no second query when the card is opened again. Free and offline unit tests,:architecture-tests:test,detektAlland the pre-pushtest lintpass.Review fix: the card kept its counts in
remember, so coming back to the screen used to load fresh ones, but the ViewModel outlives that.forget()drops the counts (and cancels a load in flight) when the card leaves composition, so that stays as before;coming back to the screen loads fresh countscovers it.