Trey T de7a70b198 Live tab: hardening pass for smooth, snappy feel
Targeted every hitch in the live-tracker flow:

1) Async DB loading. AircraftDatabase (1.5MB JSON) and
   AircraftRegistry (200KB JSON) were parsing synchronously on the
   main thread the first time anything touched them — typically when
   the user first opened the Live tab. Both now bootstrap with a
   safe fallback in init() and parse the full JSON on a background
   Task at app launch (FlightsApp.init calls preload() on both).
   Reads are NSLock-guarded with lock.withLock {} (async-safe).

2) Crossfade suppression on refresh. The 15s auto-refresh swaps the
   `aircraft` array wholesale, which made SwiftUI try to crossfade
   every annotation. Wrapped the assignment in a Transaction with
   disablesAnimations = true so the swap is instant.

3) Cached filtered aircraft. `filteredAircraft` was a computed
   property running through every aircraft on every body re-render
   (e.g. while a sheet was animating in). Moved to @State,
   recomputed via .onChange handlers on each dependency.

4) Lighter pin view. AircraftPin no longer carries the full
   LiveAircraft struct or contains a conditional ZStack — just the
   minimal {tint, rotation, isSelected} props, conforms to
   Equatable so SwiftUI can skip diffing identical pins, and uses
   .animation(nil) on the tint to prevent color crossfades during
   refresh.

5) Coarse relative-time bucketing. The footer's "updated 5s ago"
   text was ticking every second, which dirtied the footer subtree
   on every body pass. Now snaps to {just now, <30s ago, <1m ago,
   Nm ago} — no second-by-second ticks.

Net effect: tab opening is instant (DBs are warm), refreshes don't
flicker, filter sheet animation is smooth, map panning isn't fighting
view-tree rebuilds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 07:27:26 -05:00
2026-04-08 15:01:07 -05:00
2026-04-08 15:01:07 -05:00
2026-04-08 15:01:07 -05:00
S
Description
No description provided
9.7 MiB
Languages
Swift 57.9%
HTML 33.9%
JavaScript 4.5%
Python 3.5%
Shell 0.2%