The phase filter on the search results now always lists every phase. Previously, with Secondary selected, Primary was not offered — you had to go back to "Any phase" before you could pick it.
Why
FilterBar preferred result_filters.phases, which the backend computes from the returned schools after the phase filter has been applied. That leaves only the chosen phase (plus the phases PHASE_GROUPS folds into it). The phase select now reads the global /api/filters list.
Trade-off: a postcode search now also offers phases with no nearby schools, which return an empty result.
Not changed
The backend still returns result_filters.phases; it is now unused by the phase select.
School type and local authority have the same self-narrowing behaviour (picking a type leaves only that type on offer). Left for a follow-up.
Tests
New unit test FilterBarPhase.test.tsx — failed before the fix, passes after. All 263 component tests pass; tsc clean.
New E2E journey: the phase filter switches straight from secondary to primary. Runs on the post-merge staging gate.
## What
The phase filter on the search results now always lists every phase. Previously, with **Secondary** selected, **Primary** was not offered — you had to go back to "Any phase" before you could pick it.
## Why
`FilterBar` preferred `result_filters.phases`, which the backend computes from the returned schools *after* the phase filter has been applied. That leaves only the chosen phase (plus the phases `PHASE_GROUPS` folds into it). The phase select now reads the global `/api/filters` list.
Trade-off: a postcode search now also offers phases with no nearby schools, which return an empty result.
## Not changed
- The backend still returns `result_filters.phases`; it is now unused by the phase select.
- School type and local authority have the same self-narrowing behaviour (picking a type leaves only that type on offer). Left for a follow-up.
## Tests
- New unit test `FilterBarPhase.test.tsx` — failed before the fix, passes after. All 263 component tests pass; `tsc` clean.
- New E2E journey: *the phase filter switches straight from secondary to primary*. Runs on the post-merge staging gate.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The phase select read its options from the result-scoped filters, which
the backend computes after applying the phase filter. With secondary
chosen only secondary and all-through were offered, so switching to
primary meant going back to "Any phase" first. Read the global phase
list instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PR makes the FilterBar phase dropdown always use the full phase list rather than the result-scoped list. This fixes the case where choosing 'secondary' hid 'primary'. It adds a unit test and an e2e journey test. The change is small and looks correct and healthy.
🟡 Minor
nextjs-app/tests/components/FilterBarPhase.test.tsx: The module-level searchParams is reassigned inside the test and never reset. It is currently the only test in the file so it is harmless, but it could leak state if more tests are added. Resetting it in a beforeEach would be more robust.
e2e/tests/journeys.spec.ts: The e2e test assumes the 'school' search with phase=secondary returns results, and that the Phase combobox is rendered whenever results exist. If the filter bar is hidden when there are no results, the test could be flaky on sparse seed data. Seed data dependence is not documented.
## 🤖 AI Code Review (Claude Code)
The PR makes the FilterBar phase dropdown always use the full phase list rather than the result-scoped list. This fixes the case where choosing 'secondary' hid 'primary'. It adds a unit test and an e2e journey test. The change is small and looks correct and healthy.
### 🟡 Minor
- **nextjs-app/__tests__/components/FilterBarPhase.test.tsx**: The module-level `searchParams` is reassigned inside the test and never reset. It is currently the only test in the file so it is harmless, but it could leak state if more tests are added. Resetting it in a beforeEach would be more robust.
- **e2e/tests/journeys.spec.ts**: The e2e test assumes the 'school' search with phase=secondary returns results, and that the Phase combobox is rendered whenever results exist. If the filter bar is hidden when there are no results, the test could be flaky on sparse seed data. Seed data dependence is not documented.
tudor
merged commit 0c414680fd into main2026-10-01 11:03:20 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
The phase filter on the search results now always lists every phase. Previously, with Secondary selected, Primary was not offered — you had to go back to "Any phase" before you could pick it.
Why
FilterBarpreferredresult_filters.phases, which the backend computes from the returned schools after the phase filter has been applied. That leaves only the chosen phase (plus the phasesPHASE_GROUPSfolds into it). The phase select now reads the global/api/filterslist.Trade-off: a postcode search now also offers phases with no nearby schools, which return an empty result.
Not changed
result_filters.phases; it is now unused by the phase select.Tests
FilterBarPhase.test.tsx— failed before the fix, passes after. All 263 component tests pass;tscclean.🤖 Generated with Claude Code
🤖 AI Code Review (Claude Code)
The PR makes the FilterBar phase dropdown always use the full phase list rather than the result-scoped list. This fixes the case where choosing 'secondary' hid 'primary'. It adds a unit test and an e2e journey test. The change is small and looks correct and healthy.
🟡 Minor
searchParamsis reassigned inside the test and never reset. It is currently the only test in the file so it is harmless, but it could leak state if more tests are added. Resetting it in a beforeEach would be more robust.