Add Deleted Media toggle to Top Videos on the dashboard - #1953
Open
subodhr258 wants to merge 1 commit into
Open
Conversation
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.
Contributor
There was a problem hiding this comment.
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
ToggleControlnext to the Export button (default off). - Filters out rows where
exists === falsefrom 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Deleted Mediatoggle (ToggleControl) in the Top Videos header, default off.exists: false(set by thetop-videosREST proxy when the attachment no longer exists) are filtered out of the table unless the toggle is on.Notes
Testing
npx eslint pages/dashboard/Dashboard.js— cleannpm run test:unit— 16/16 passwp-scripts build— compiles successfully