Skip to content

New Stats: Improve Top List screen#24868

Merged
kean merged 5 commits intotrunkfrom
task/improve-top-list-performance
Sep 25, 2025
Merged

New Stats: Improve Top List screen#24868
kean merged 5 commits intotrunkfrom
task/improve-top-list-performance

Conversation

@kean
Copy link
Copy Markdown
Contributor

@kean kean commented Sep 19, 2025

Changes

  • Improve performance and animations when showing a full Top List with a large number of items. List renders lazily, has better animations, and by showing only top 50 items we improve it further.
  • Show the Top 10 items in the Top List screen in a dedicated section

Screenshots

The screen now only shows 50 items by default. I assume most users will never scroll past that. If they really need to see more, there is a "Show More" button.

Screenshot 2025-09-19 at 2 15 30 PM

To make the list a bit more interesting and complex, I tried showing the top items in a "Top 10" lists with numbering. I think it turned out well.

Screenshot 2025-09-21 at 11 25 47 AM Screenshot 2025-09-21 at 11 25 54 AM

@kean kean added this to the 26.4 milestone Sep 19, 2025
@kean kean requested a review from crazytonyli September 19, 2025 19:26
@kean kean added the Stats label Sep 19, 2025
@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Sep 19, 2025

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number29181
VersionPR #24868
Bundle IDorg.wordpress.alpha
Commit71ad107
Installation URL0ri9m2dt4tkpo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Sep 19, 2025

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number29181
VersionPR #24868
Bundle IDcom.jetpack.alpha
Commit71ad107
Installation URL1gqf83s0o52o0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@kean kean force-pushed the task/improve-top-list-performance branch from 4ab9eb6 to 228f8a1 Compare September 21, 2025 15:35
Group {
if viewModel.isFirstLoad {
listContent(data: mockData())
.redacted(reason: .placeholder)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not feel right to implement skeleton UI using mock data. It looks fine on screen, but using mock data in production just doesn't feel right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not feel right to implement skeleton UI using mock data.

Can you elaborate why? That's how every screen with .redacted(reason: .placeholder) does it. What's the alternative?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mockData reads the test data from memory or the app bundle, and then it's used to build the view. But I imagine you don't actually need to use any real content, just random text and numbers would be fine too?

Eventually, we are going to remove the mock data, whether it's the hard-coded ones or the ones in the bundle. And when we remove them, we'd need to change this mockData() usage to be something else. I guess that's what I meant, "does not feel" right.

I'm not too bothered, though. It's okay if you'd like to keep the change. We'll cross that bridge when we come to it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two separate "mock data" types in Stats. There mock data in MockStatsService that is elaborate, covers multiple years and is based on JSON files. And then there is small in-memory TopListData.mock designed specifically to use in placeholders and SwiftUI previews for quick testing. It's basically arbitrary text and numbers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I probably thought of them as one thing. 👍

static let mostDownloadeded = AppLocalizedString("jetpackStats.topList.mostDownloads", value: "Most Downloaded", comment: "Title for chart")

static func top(_ count: Int) -> String {
String.localizedStringWithFormat(AppLocalizedString("jetpackStats.postDetails.topN", value: "Top %1$d", comment: "Top N, e.g. 'Top 10'"), count)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In English, "Top 10" makes much more sense than "Top ten". But in Chinese, the difference between "前十名" and "前10名" is more subtle. The former is more formal, but both can be used as translations. I'm not sure about other languages, though. Given that, maybe we should translate "Top 10" and "Top 50", instead of "Top x"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea – updated.

@kean kean force-pushed the task/improve-top-list-performance branch from 228f8a1 to d44923d Compare September 23, 2025 19:26
@kean kean requested a review from crazytonyli September 23, 2025 19:26
@sonarqubecloud
Copy link
Copy Markdown

@kean kean enabled auto-merge September 25, 2025 12:02
@kean kean disabled auto-merge September 25, 2025 13:50
@kean kean merged commit 3bf316d into trunk Sep 25, 2025
30 of 32 checks passed
@kean kean deleted the task/improve-top-list-performance branch September 25, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants