Skip to content

Conversation

@ilicfilip
Copy link
Collaborator

The "Filter by source" dropdown is populated based only on the options visible on the first page of results, but since DataTables uses server-side pagination, there are other plugin names that aren't included in the filter dropdown.

This PR fixes that issue.

@github-actions
Copy link

github-actions bot commented Dec 18, 2025

Test on Playground
Test this pull request on the Playground
or download the zip

@ilicfilip ilicfilip changed the title include all plugins, not just those available on first page load Include all plugins in the Source filter, not just those available on first page load Dec 18, 2025
@aristath aristath requested a review from Copilot December 19, 2025 08:26
Copy link

Copilot AI left a comment

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 fixes an issue where the "Filter by source" dropdown in DataTables was only populated with plugin names visible on the first page of results. With server-side pagination, many plugin names were missing from the dropdown. The fix collects all unique plugin sources before applying any filters or pagination, and passes them to the frontend via the AJAX response.

Key changes:

  • Backend endpoints now collect and return all unique plugin sources in the sources field of the response
  • Frontend stores sources from AJAX responses and uses them to populate filter dropdowns
  • Filtering logic in get_options_that_do_not_exist() refactored to build full data structure before filtering

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/class-rest.php Added logic to collect all unique plugin sources before filtering/pagination in three REST endpoints (get_unused_options, get_used_not_autoloaded_options, get_options_that_do_not_exist), and includes them in the response as sources array
js/admin-script.js Added tableSources storage object, created createColumnFilterSetup helper to bind table selectors, updated dataSrc callbacks to store sources from AJAX responses, and modified setupColumnFilters to use stored sources for server-side tables while falling back to column data for client-side tables

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

@aristath aristath merged commit a99ed15 into develop Dec 19, 2025
8 checks passed
@aristath aristath deleted the filip/fix-source-filter branch December 19, 2025 11:41
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.

3 participants