Skip to content

WOOA7S-2210: Premium Analytics: Show the no-results state in four more chart widgets - #52868

Merged
Nikschavan merged 1 commit into
trunkfrom
wooa7s-2210-chart-empty-state-detail-widgets
Sep 29, 2026
Merged

Nikschavan merged 1 commit into
trunkfrom
wooa7s-2210-chart-empty-state-detail-widgets

Conversation

@Nikschavan

Copy link
Copy Markdown
Member

Fixes WOOA7S-2210

Proposed changes

  • WOOA7S-2210: Premium Analytics: Handle zero-data periods in charts and highlights #52795 moved the chart widgets built on MetricTabsChart to an in-chart no-results message, but four of them never got the empty prop: Post views, Author performance, Video views and Store performance. Their data is zero-filled per bucket, and their isEmpty only checks for a missing post, author or video, so a period with no data still drew a flat line at zero.
  • Each of them now passes ChartEmptyState the same way the Traffic chart does. The headline tab keeps its 0, and the chart area shows the magnifier and "We couldn’t find results for this time period.".
  • Store performance could also go through the empty state with an empty series instead of zeros. MetricTabsChart treats both the same way, so the message covers either response.
  • Loading, error and the scope prompts ("Open a post or page report…") are unchanged.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Get this branch onto a site with Stats data and the Premium Analytics dashboard enabled, either a Jurassic Ninja site with the branch synced or the Jetpack Beta Tester plugin pointed at wooa7s-2210-chart-empty-state-detail-widgets.
  • Open Stats v2, open a post with no views in the selected period, and check that Post views shows the no-results message under its 0 instead of a flat line. Switch between line and bar; the message should stay.
  • Pick a period where the post has views and check that the chart draws again.
  • Do the same on an author with no views (Author performance) and a video with no plays (Video views).
  • On a store with no orders or visits in the period, the Store performance chart should show the same message for each tab.
Before After
Post views at 0 with a flat line along the bottom of a 0 to 80 axis Post views at 0 with the magnifier and "We couldn’t find results for this time period." in the chart area
The chart draws a flat line at zero. The 0 stays and the chart area says there are no results.

I checked Post views on my local site. Author performance, Video views and Store performance are covered by unit tests that fail without the new prop.

Post views, Author performance, Video views and Store performance pass MetricTabsChart no empty prop, so a period with no data still draws a flat zero line. Pass ChartEmptyState, as the traffic chart does.
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the wooa7s-2210-chart-empty-state-detail-widgets branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack wooa7s-2210-chart-empty-state-detail-widgets

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@Nikschavan
Nikschavan requested a lite review from Copilot September 28, 2026 12:10
@Nikschavan
Nikschavan marked this pull request as ready for review September 28, 2026 12:10
@Nikschavan
Nikschavan requested a review from a team as a code owner September 28, 2026 12:10
@Nikschavan Nikschavan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 28, 2026

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Address the three test reliability findings and add the required paired plugin changelog entries.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Updates four Premium Analytics widgets to show an in-chart no-results state for empty periods while preserving headline metrics.

Changes:

  • Enables ChartEmptyState for four chart widgets.
  • Adds empty-period test coverage.
  • Adds a Premium Analytics changelog entry.
File Summary Review notes
projects/​packages/​premium-analytics/​widgets/​video-detail-views-performance/​render.tsx Enables the chart empty state. —
projects/​packages/​premium-analytics/​widgets/​video-detail-views-performance/​__tests__/​video-detail-views-performance.test.tsx Tests no-results messaging. Moderate (1 vote): configure fake timers for findByText.
projects/​packages/​premium-analytics/​widgets/​store-performance/​render.tsx Enables the chart empty state. —
projects/​packages/​premium-analytics/​widgets/​store-performance/​__tests__/​render.test.tsx Tests empty store data handling. —
projects/​packages/​premium-analytics/​widgets/​post-views/​render.tsx Enables the chart empty state. —
projects/​packages/​premium-analytics/​widgets/​post-views/​__tests__/​post-views.test.tsx Tests no-results messaging. Moderate (1 vote): configure fake timers for findByText.
projects/​packages/​premium-analytics/​widgets/​author-performance/​render.tsx Enables the chart empty state. —
projects/​packages/​premium-analytics/​widgets/​author-performance/​__tests__/​author-performance.test.tsx Tests no-results messaging. Moderate (1 vote): configure fake timers for findByText.
projects/​packages/​premium-analytics/​changelog/​update-pa-chart-empty-state-detail-widgets Documents the user-visible change. Nit (4 votes): add paired plugin changelog entries.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Significance: patch
Type: changed

Dashboard: Show the no-results message in the Post views, Author performance, Video views and Store performance charts for a period with no data, instead of a flat zero line.
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/packages/widgets-toolkit/src/helpers/format-orders-metrics.ts 3/5 (60.00%) 40.00% -2 💚
projects/packages/premium-analytics/widgets/store-performance/render.tsx 48/53 (90.57%) 90.57% -48 💚

Full summary · PHP report · JS report

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Nikschavan LGTM!

@Nikschavan
Nikschavan merged commit 589aaff into trunk Sep 29, 2026
89 checks passed
@Nikschavan
Nikschavan deleted the wooa7s-2210-chart-empty-state-detail-widgets branch September 29, 2026 03:55
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Status] UI Changes Add this to PRs that change the UI so documentation can be updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants