useTrackingSession is the recommended entry point for tracking-aware plugins. It provides derived tracking state — isTracking, isPaused, elapsedTime (ticking locally every second), phase — alongside flight lifecycle controls and crash recovery handling.
Use this hook when your plugin needs to know whether a flight is active or wants to show elapsed time. Fall back to useFlightManager only when you need the raw CurrentFlight object without derived fields, or want to avoid the extra effect for the elapsed timer.
Import
Signature
Return value
RecoverableFlight
When Stratos detects a flight was interrupted (e.g. the app crashed mid-flight), pendingRecovery is populated with a lean summary of that flight. See RecoverableFlight for the full shape.
Usage
Basic tracking display
Start a flight with options
Recovery handling
Notes
elapsedTimeis computed locally via a 1-secondsetIntervalso it ticks smoothly between server broadcasts (which occur every ~15 seconds).- The hook uses
staleTime: Infinityand refetches on socket reconnect to catch flights started before the UI loaded. - The TanStack Query cache key is
["tracking-session", "state"]— this is the same key used across the shell and all plugins, ensuring consistent state with no duplicate requests.