Skip to content

Form calendar: repaint it when Max correspondances (and the other filters) change - #64

Merged
davd-gzl merged 1 commit into
mainfrom
claude/max-correspondence-calendar-sync-0ew6s7
Jul 27, 2026
Merged

davd-gzl merged 1 commit into
mainfrom
claude/max-correspondence-calendar-sync-0ew6s7

Conversation

@davd-gzl

Copy link
Copy Markdown
Collaborator

The bug

Changing Max correspondances left the Trip tab's "When to leave?" calendar untouched — the month sitting directly above the control kept the old colours, greyed on the very days the new connection budget had just opened up.

The calendar is derived from the whole form (repaintFormCalendar → readQueryFromForm() → odConnOptsFor / getawayOptsFor / filterOptsFor), but only the origin and destination inputs were wired to repaint it, so every other filter it depends on silently left a stale grid behind.

The fix

Wire each control the grid actually depends on to the repaint:

  • max connections, the via hub, depart-after / depart-before / arrive-before, the max-duration cap, the train type, night trains + only-night, overnight stopovers, and the same-day minimum time on site.
  • Typed fields (via, max duration) debounce like the route fields; the rest repaint on the next frame so the control's own visual update paints first — deferFormCalRepaint, factored out of the existing origin/destination handler.

Filters stay staged: this only repaints the calendar, the results still wait for Search (the existing "stages a field change" test and the edits stay staged until Search E2E scenario both still pass).

Verification

  • New regression test in tests/app.smoke.test.ts: Paris → Toulouse with conn=0 has no possible day (the one direct train isn't a free-MAX seat); raising the select to 1 change greens up the via-Bordeaux day immediately, and the results only follow on Search. It fails on main and passes here.
  • Real browser (built dist, committed data snapshot), Paris origin-only: per-day destination counts go 1660 → 1820 when allowing 2 changes, live on the select's change.
  • Gates: tsc --noEmit, npm test (151 passed), npm run build, npm run test:e2e (14/14).

docs/user-flows.md updated to describe what the calendar recomputes on.


Generated by Claude Code

…ters) change

The Trip tab's "When to leave?" calendar is derived from the whole form —
readQueryFromForm() feeds odConnOptsFor / getawayOptsFor / filterOptsFor — but only
the origin and destination fields were wired to repaint it. Changing "Max
correspondances", the control sitting directly beneath it, left the previous month on
screen: days that the new connection budget had just opened up stayed grey until the
route was retyped.

Wire every control the grid actually depends on to the repaint: max connections, the
via hub, depart-after / depart-before / arrive-before, the max-duration cap, the train
type, night trains + only-night, overnight stopovers, and the same-day minimum time on
site. Typed fields (via, max duration) debounce like the route fields; the rest repaint
on the next frame so the control's own update paints first (deferFormCalRepaint, factored
out of the origin/destination handler).

This only repaints the calendar — the filters stay staged, and the results still wait
for Search, as before.
@davd-gzl
davd-gzl merged commit 064826f into main Jul 27, 2026
1 check passed
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.

2 participants