Skip to content

SEO: Fix Internal Redirect type filter showing no results - #4323

Open
finnar-bin wants to merge 1 commit into
devfrom
fix/4318-redirects-internal-type-filter
Open

SEO: Fix Internal Redirect type filter showing no results#4323
finnar-bin wants to merge 1 commit into
devfrom
fix/4318-redirects-internal-type-filter

Conversation

@finnar-bin

Copy link
Copy Markdown
Contributor

Resolves #4318

Summary

  • The Type filter's "Internal" option used the key internal, but redirect records actually store internal (page-linked) redirects with targetType: "page" — so filtering by Internal never matched any rows.
  • Renamed the TYPE_FILTERS key from internal to page so it matches the real targetType value, and added data-cy attributes to each type filter menu item for testability.
  • Added a regression Cypress spec covering the Internal/External/Wildcard type filters and the clear-filter flow.

Test plan

  • Go to /redirects, create/seed an internal redirect, open the Type filter, select Internal — the redirect appears.
  • Confirm External and Wildcard filters still correctly show only their respective redirect types.
  • Confirm clearing the type filter restores the full list.
  • ./node_modules/.bin/cypress run --spec "cypress/e2e/seo/redirects/redirects.spec.js" passes.

The "Internal" option in TYPE_FILTERS was keyed "internal", but the
table filters by comparing the raw targetType value ("page" | "external"
| "path") directly. The key mismatch meant selecting "Internal" always
produced an empty table. Also adds data-cy attributes to the type
filter menu items so they're testable, and extends the Cypress spec
with a regression-covering Type Filter suite.
@finnar-bin finnar-bin added bug Something isn't working severity: medium Noticeable impact on a workflow, but a workaround exists labels Sep 8, 2026
@finnar-bin finnar-bin self-assigned this Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Code Review — ✅ No blockers

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

QA Review — ✅ PASS

Validates #4318: Redirects - Internal Redirect Filter showing no results

  1. ✅ Selecting Type → Internal on /redirects lists all redirects whose stored targetType is "page" — TYPE_FILTERS key changed from internal to page (TableSortFilters.tsx:22), so setTypeFilter("page") now matches redirect.targetType === "page" in index.tsx:202
  2. ✅ Type filter values map 1:1 to RedirectsTargetType ("page" | "external" | "path") — all three TYPE_FILTERS keys now exactly match the RedirectsTargetType union
  3. ✅ External and Wildcard filters continue to return correct subsets — their keys (external, path) are unchanged by the diff
  4. ✅ Active-filter button label shows correct text when Internal is selected — getButtonText still reads TYPE_FILTERS[typeFilter], and the "page" key still resolves to "Internal - linked to an item in this instance"
  5. ✅ Clearing the Type filter restores the full list — onRemoveFilter still calls setTypeFilter(null), untouched by this change
  6. ✅ Cypress spec added guarding against key drift — new "Type Filter" describe block in redirects.spec.js seeds page/external/path redirects via the API and asserts each filter option plus filter-clearing
Suggested Cypress coverage

cypress/e2e/seo/redirects/redirects.spec.js already gained the needed coverage in this PR: it seeds one redirect of each targetType (page/external/path) with a shared UUID-scoped path prefix, then asserts that selecting "Internal" surfaces only the page row (the regression case for #4318), that "External" and "Wildcard" still isolate their own rows (no regression), that the active-filter button displays the correct label, and that clearing the filter restores all three rows. This closes the gap the issue called out and ties the assertions to the data-cy hooks (typeFilterOption_<key>, targetType_default/_selected/_clearFilter) rather than text or class matching.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Negative QA

No reproducible edge-case failures found on the surfaces this PR changes.

Also checked and working correctly
  • Selecting "Internal" from the Type filter dropdown correctly isolates redirects with targetType: "page" (the regression from Redirects - Internal Redirect Filter showing no results #4318 is fixed — previously this always returned zero results).
  • Selecting "External" and "Wildcard" continue to correctly isolate their respective redirect types.
  • Clicking the clear-filter (X) button on the Type filter button restores the full unfiltered list.
  • Each MenuItem in the Type filter dropdown exposes the new data-cy="typeFilterOption_<key>" attribute correctly keyed to the underlying data value (page, path, external), not the old mismatched key.
  • Combining the Type filter with the HTTP Code filter, including combinations that produce zero matching rows, renders the DataGrid's empty state cleanly with no console errors or crashes.
  • Combining the Type filter with the free-text search box (Filter Redirects) correctly narrows to the intersection of both filters, and updates immediately when either filter changes.
  • Rapidly switching the Type filter selection between different options (Internal → External) in quick succession updates the grid to the final selection with no stale/flickering rows or duplicate requests.
  • Re-opening the Type filter menu after a selection correctly shows the previously selected option as active/highlighted.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Overall Coverage

Lines Statements Branches Functions
61.09% 60.67% 56.29% 55.54%

Changed Files Coverage

File Lines Statements Branches Functions
src/apps/seo/src/views/RedirectsManager/RedirectsTable/TableSortFilters.tsx 71.87% 71.87% 85.71% 62.50%

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

Labels

bug Something isn't working severity: medium Noticeable impact on a workflow, but a workaround exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirects - Internal Redirect Filter showing no results

2 participants