Files
tesla-roadtrip/client
tony 0a97ea2006 feat(ui): Phase 4 — variant cache + compare-on-map overlay
Switching between Fastest / Scenic / Cheapest used to require a fresh
Grok call every time (~90s). Now each variant's itinerary + OSRM
legs are cached the moment they're computed, so:

- Switching back to a previously-viewed variant is instant — no Grok
  round-trip, just a state swap. A toast reports "(cached)" so the
  user knows nothing was refetched.
- The variant strip gains a Compare (n) button that lights up once
  at least two variants are cached. Toggling it overlays the other
  cached variants on the map as dashed lines in their tone colour
  (green for Scenic, blue for Cheapest), while the selected variant
  stays solid red on top.
- Map legend swaps to a variant-key list while Compare is active so
  the user can read which dashed line is which.
- The cache is also kept fresh as soon as legs[] finishes computing
  for the active variant — so toggling Compare immediately after a
  fresh plan still shows real routes, not stale ones.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:27:02 +01:00
..