fix(web): keep departures sorted by arrival time, not catchability#23
Merged
Conversation
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
|
🚀 Preview deployed: https://preview-23.tablo.run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tramarriving 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.
boardToDeparturesalreadysorts ascending by
predicted ?? scheduled; the lead is now simply the nextdeparture (
list[0]) and the rest follow in order. Reachability still tintseach 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 theleadIdx = first non-misspromotion; lead =
list[0], rest =list.slice(1, max + 1).docs/.../2026-06-08-tablo-ui-redesign-design.md— update the lead-selectionrule to match.
Verification
bun run lint— cleanbunx vitest run— 82 tests pass🤖 Generated with Claude Code
Generated by Claude Code