Skip to content

Stats Review: Add ChartCard, TopListCard, StandaloneChartView (P12) - #24724

Closed
kean wants to merge 1 commit into
review/add-chartsfrom
review/add-cards
Closed

Stats Review: Add ChartCard, TopListCard, StandaloneChartView (P12)#24724
kean wants to merge 1 commit into
review/add-chartsfrom
review/add-cards

Conversation

@kean

@kean kean commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

This PR adds the actual cards. The cards load the data and manage its presentation. The more challenging bit was to get it to stagger the reloads in the case the user taps quickly on "backward" or "forward" button.

I put both charts in the same PR as there are many similarities between them.

This PR also contains StandaloneChartCard which is used on the PostStatsView. This component could be improved as there is likely something to reuse with the other cards.

I also included TopListScreenView that opened when you tap "Show All" on the "Top List" card:

Screenshot 2025-08-05 at 11 24 37 AM

@kean kean added this to the Pending milestone Aug 5, 2025
@kean kean added the Stats label Aug 5, 2025
@kean kean mentioned this pull request Aug 5, 2025
14 tasks
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2025

Copy link
Copy Markdown

isStale = false
chartData = data
} catch is CancellationError {
return

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.

I think you'd want to set the isLoading = false here. Or, you could add defer { isLoading = false } to the top of the function, and don't need to worry about early returns.

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.

When the view model cancels the request, it effectively unsubscribes from the previous request and starts a new one – there is no need to handle the termination of the cancelled request.

cachedCountriesMapData = nil
}
} catch is CancellationError {
return

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.

Potentially missed isLoading = false here too.

@kean kean closed this Aug 29, 2025
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