Skip to content

Fix: reset search and filters when switching content types in Bulk Editor - #23514

Open
vraja-pro wants to merge 4 commits into
feature/bulk-editor-ph2from
3086-search-query-and-filters-persist-when-switching-between-content-types
Open

Fix: reset search and filters when switching content types in Bulk Editor#23514
vraja-pro wants to merge 4 commits into
feature/bulk-editor-ph2from
3086-search-query-and-filters-persist-when-switching-between-content-types

Conversation

@vraja-pro

@vraja-pro vraja-pro commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Context

When switching between content types in the Bulk Editor, the search query and filters applied to the previous content type were being carried over instead of resetting. Each content type should open with a clean, unfiltered state.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the search query and filters persisted when switching between content types in the Bulk Editor.

Relevant technical choices:

  • The extraReducers handler for setActiveContentType in query.js previously only reset page to 1. It now returns createInitialQueryState(), which resets search, statuses, needsImprovement, and page all at once.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  1. Open the Bulk Editor.
  2. Navigate to any content type (e.g. Pages).
  3. Apply one or more filters (e.g. SEO score status).
  4. Enter a value in the search field and perform a search.
  5. Switch to a different content type (e.g. Posts).
  6. Verify the search field is empty and all filters are cleared.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

  • Follow the same steps as the acceptance test above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Bulk Editor — search and filter state management when switching content types.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and commited the results, if my PR introduces new images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/plugins-automated-testing/issues/3086

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vraja-pro vraja-pro added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Jul 28, 2026
@vraja-pro vraja-pro added this to the feature/bulk-editor-ph2 milestone Jul 28, 2026
…ntent type switch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coveralls-official

coveralls-official Bot commented Jul 28, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 0

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.04%) to 55.598%

Details

  • Coverage increased (+0.04%) from the base build.
  • Patch coverage: 5 of 5 lines across 2 files are fully covered (100%).
  • 21 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

21 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
packages/js/src/introductions/initialize.js 16 0.0%
packages/js/src/ai-content-planner/initialize.js 5 88.0%

Coverage Stats

Coverage Status
Relevant Lines: 72894
Covered Lines: 40426
Line Coverage: 55.46%
Relevant Branches: 18899
Covered Branches: 10609
Branch Coverage: 56.14%
Branches in Coverage %: Yes
Coverage Strength: 41287.17 hits per line

💛 - Coveralls

…nt types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

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 fixes Bulk Editor state leakage by ensuring the query state (search + filters + pagination) is reset whenever the active content type changes, so each content type starts unfiltered.

Changes:

  • Reset the entire Bulk Editor query slice to its initial state when setActiveContentType is dispatched.
  • Update the query slice unit test to assert that all query state is reset (not just page).
  • Clear the SearchBox’s local input value and cancel any pending debounced search when the content type changes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/js/tests/bulk-editor/store/query.test.js Updates coverage to assert full query reset on content type switches.
packages/js/src/bulk-editor/store/query.js Changes setActiveContentType handling to return createInitialQueryState() (full reset).
packages/js/src/bulk-editor/components/search-box.js Resets local input state and cancels debounced dispatches on content type change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants