CMM-2133: Self-fetch clicks, search, video, file downloads and authors stats detail#23077
CMM-2133: Self-fetch clicks, search, video, file downloads and authors stats detail#23077adalpari wants to merge 3 commits into
Conversation
These cards fetched the full unbounded list (max=0) and passed the whole list to their detail Activity through the launching Intent, risking a TransactionTooLargeException on sites with many entries — the same issue already fixed for referrers. Generalize the referrers self-fetch: add MostViewedDetailSource and MostViewedDetailFetcher, turn MostViewedDetailViewModel into a generic load(source, period), and replace startReferrers with startSelfFetch so Clicks, Search Terms, Video Plays and File Downloads re-fetch their own full list when the detail screen opens. Add AuthorsDetailViewModel and make AuthorsDetailActivity self-fetch the same way (with loading/error states). Only the selected period crosses the Intent now. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Generated by 🚫 Danger |
Add unit tests for AuthorsDetailViewModel and MostViewedDetailFetcher, and update MostViewedDetailViewModelTest for the new load(source, period) API and MostViewedDetailFetcher-based constructor (the old test still referenced loadReferrers/statsRepository and no longer compiled). Also align AuthorsDetailViewModel error handling with MostViewedDetailViewModel: rethrow CancellationException instead of swallowing it, and log via AppLog + show the localized stats_error_unknown string rather than the raw exception message. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Follow-up to the stats detail self-fetch work, from PR review: - Remove the now-orphaned getDetailData()/AuthorsDetailData and their dead backing fields, the unused cardType abstract contract and its subclass overrides, and the newly-unused AuthorsViewModel resourceProvider dependency (plus the tests that only covered them). - Use the isAuthError flag the fetcher already produced: propagate it into the Most Viewed and Authors detail error states and offer an "Open WP Admin" action on auth errors, matching the cards and the UTM detail screen. - Align the empty-list maxViewsForBar default to 0L across the detail screens. - Reduce return counts in readSelfFetchArgs and fetch to satisfy detekt, and drop a blank line before a brace for checkstyle. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #23077 +/- ##
==========================================
+ Coverage 37.33% 37.36% +0.02%
==========================================
Files 2337 2339 +2
Lines 126824 126925 +101
Branches 17470 17492 +22
==========================================
+ Hits 47354 47426 +72
- Misses 75593 75618 +25
- Partials 3877 3881 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Note: you might find an error when retrieving |
nbradbury
left a comment
There was a problem hiding this comment.
Nice improvement! I left a couple of comments but I believe they're not the result of this PR. ![]()




Description
Generalizes the new Stats detail-screen self-fetch — previously referrers-only (shipped in #23066) — to the remaining "most viewed" sources and to Authors.
These cards were fetching the full, unbounded list (
max = 0) and passing the whole list to their detailActivitythrough the launchingIntent, risking aTransactionTooLargeExceptionon sites with many entries. Now only the selected period crosses the Intent, and the detail screen re-fetches its own full list.Changes
MostViewedDetailSourceenum andMostViewedDetailFetcher(routes each source to the rightStatsRepositorycall and maps to the common detail shape).MostViewedDetailViewModelinto a genericload(source, period)and replacestartReferrers()withstartSelfFetch(), so Clicks, Search Terms, Video Plays and File Downloads re-fetch their own full list when the detail screen opens.AuthorsDetailViewModeland makeAuthorsDetailActivityself-fetch the same way, with loading/error states.NewStatsActivity,AuthorsViewModel,BaseStatsCardViewModel.Notes
trunk, so it contains only the self-fetch generalization (8 files). The referrer expand/collapse UI it was originally stacked on has already merged via CMM-2133: Expandable referrers with children in new Stats #23066.Test instructions
CMM-2133
🤖 Generated with Claude Code