Skip to content

fix(web): keep departures sorted by arrival time, not catchability#23

Merged
i11v merged 1 commit into
mainfrom
claude/stable-departure-sorting-m11hjb
Jun 28, 2026
Merged

fix(web): keep departures sorted by arrival time, not catchability#23
i11v merged 1 commit into
mainfrom
claude/stable-departure-sorting-m11hjb

Conversation

@i11v

@i11v i11v commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Problem

Departures were effectively sorted by the ability to catch them. The board
promoted the first catchable departure into the large lead slot
(leadIdx = first non-miss) and built the rest of the list around it. So a tram
arriving in 1 minute that you can't make would render below a later tram you
can make. As walk-time / catch range drifted across refreshes, departures
slipped in and out of catch range and the rows constantly re-sorted.

Fix

Make the display order follow arrival time exactly. boardToDepartures already
sorts ascending by predicted ?? scheduled; the lead is now simply the next
departure (list[0]) and the rest follow in order. Reachability still tints
each row (make / run / miss), but it never reorders them — so the board stays
stable regardless of catch range.

Changes

  • packages/web/src/components/StopCard.tsx — drop the leadIdx = first non-miss
    promotion; lead = list[0], rest = list.slice(1, max + 1).
  • docs/.../2026-06-08-tablo-ui-redesign-design.md — update the lead-selection
    rule to match.

Verification

  • bun run lint — clean
  • bunx vitest run — 82 tests pass

🤖 Generated with Claude Code


Generated by Claude Code

The board promoted the first *catchable* departure to the lead slot
(`leadIdx = first non-miss`), pushing an earlier un-catchable departure
below it. As walk-time / catch range drifted across refreshes, rows
re-sorted — a tram arriving in 1 min you can't make would jump below a
later one you can, then back.

Make the lead simply the next departure (`list[0]`). Order now follows
arrival time exactly; reachability still tints rows but never reorders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWgwTqEDjsfwr8p8gXk52H
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed: https://preview-23.tablo.run
fallback: https://tablo-pr-23.i11v.workers.dev

@i11v i11v marked this pull request as ready for review June 28, 2026 17:05
@i11v i11v merged commit 50f4dd0 into main Jun 28, 2026
2 checks 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