Paginate the flights list with keyset cursor (audit M1) #13
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/flights-pagination"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From
docs/audit-2026-06.mdM1 (scoped to the flight-list portion). Branches offmain.What changed
listFlightsnow takes a(date, id)cursor +limit(default 50) and returns{ rows, nextCursor }. Keyset pagination over the(date DESC, id DESC)order — served byflight_user_id_date_idx(confirmed viaEXPLAIN QUERY PLAN) and correct under concurrent inserts/deletes (unlike OFFSET).(n+)when more remain.Deliberately not done (per scoping decision): dashboard-aggregation caching (stale-stats/invalidation risk not worth it at personal-log scale) and list virtualization (pagination suffices; avoids a new dep).
Only
flights/index.tsxconsumeslistFlights, so the signature change is contained. Verified:pnpm typecheck/lint/test(40/40) pass; query plan uses the index.listFlights now takes a (date, id) cursor + limit (default 50) and returns { rows, nextCursor }, using keyset pagination over the (date DESC, id DESC) order — served by the flight_user_id_date_idx index and correct under concurrent inserts/deletes (unlike OFFSET). The flights list renders a page at a time with a 'Load more' button instead of loading/rendering every row. Delete now drops the row from local state instead of invalidating the loader, so additional loaded pages aren't discarded. Dashboard-aggregation caching and list virtualization intentionally skipped (not worth the risk/dep at personal scale; see docs/audit-2026-06.md M1).