Skip to content

Add Deleted Media toggle to Top Videos on the dashboard - #1953

Open
subodhr258 wants to merge 1 commit into
mainfrom
feature/top-videos-deleted-media-toggle
Open

Add Deleted Media toggle to Top Videos on the dashboard#1953
subodhr258 wants to merge 1 commit into
mainfrom
feature/top-videos-deleted-media-toggle

Conversation

@subodhr258

Copy link
Copy Markdown
Collaborator

Summary

Top Videos on the analytics dashboard currently lists media that was deleted from the WordPress media library (rows titled ID: N (Deleted Media)) alongside existing videos. This PR hides those rows by default and adds a Deleted Media toggle next to the Export button to show them on demand.

Changes

  • New Deleted Media toggle (ToggleControl) in the Top Videos header, default off.
  • Rows with exists: false (set by the top-videos REST proxy when the attachment no longer exists) are filtered out of the table unless the toggle is on.
  • The CSV export uses the same filtered list, so it matches what is displayed.
  • The "No videos found." empty state no longer renders while the skeleton loader is showing.

Notes

  • Filtering is client-side in the plugin: pagination and totals come from the analytics microservice, which doesn't know which attachments still exist in WordPress. A page can therefore show fewer than 10 rows when deleted media is hidden.

Testing

  • npx eslint pages/dashboard/Dashboard.js — clean
  • npm run test:unit — 16/16 pass
  • wp-scripts build — compiles successfully

Top Videos rows for attachments deleted from the media library are now
hidden by default. A new toggle next to the Export button shows them on
demand; the CSV export follows the same visibility.
Copilot AI review requested due to automatic review settings June 12, 2026 11:01

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.

Pull request overview

This PR improves the “Top Videos” table on the analytics dashboard by hiding rows that correspond to deleted WordPress media (attachments that no longer exist) by default, while still allowing users to view and export them on demand via a new toggle.

Changes:

  • Adds a Deleted Media ToggleControl next to the Export button (default off).
  • Filters out rows where exists === false from the table unless the toggle is enabled.
  • Ensures CSV export uses the same filtered list as the table, and prevents the “No videos found.” empty state from rendering during the skeleton loading state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants