fix(compare): render all-secondary comparisons — re-run phase detection after basket hydration

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB
This commit is contained in:
Tudor
2026-07-16 14:42:09 +01:00
co-authored by Claude Fable 5
parent a86a2be96c
commit 026a7ab6aa
3 changed files with 111 additions and 1 deletions
+5 -1
View File
@@ -173,7 +173,11 @@ export function ComparisonView({
if (!metricFitsPhase) {
setSelectedMetric(newPhase === 'secondary' ? 'attainment_8_score' : 'rwm_expected_pct');
}
}, [comparisonData]); // eslint-disable-line react-hooks/exhaustive-deps
// selectedSchools is a dep because the basket hydrates after mount: the
// first run sees an empty basket and bails, so it must re-fire when the
// schools arrive. primarySchools/secondarySchools/metrics/selectedMetric
// are intentionally omitted (derived or would cause loops).
}, [comparisonData, selectedSchools]); // eslint-disable-line react-hooks/exhaustive-deps
const handlePhaseChange = (phase: 'primary' | 'secondary') => {
phaseLockedByUser.current = true;