Skip to content

useWorkoutControls

useWorkoutControls(): WorkoutControls

Defined in: console-sdk/src/react/hooks/useWorkoutControls.ts:151

The always-available workout lifecycle controls (SDK_PLAN.md §3.7 row 16, §3.6.5). A flat hook so buttons wire without narrowing on the session phase. Bare verbs never reject (§3.8.3): start resolves boolean (failure into startError), end resolves WorkoutResult | null (failure into the snapshot, phase 'failed'), and pause/resume/abandon never throw. The *Async twins (startAsync, endAsync) reject with a typed SessionError for imperative composition. Safe from the first render; throws OutsideProviderError when no <ConsoleProvider> is above the caller.

WorkoutControls

the WorkoutControls verb surface plus the reactive isStarting / startError mutation state.

const { start, pause, resume, end, dismiss, isStarting, startError } = useWorkoutControls();
<Button title="Start" onPress={() => start({ kind: 'free', devices: rower.id })} />;
<Button title="Pause" onPress={pause} />; // never rejects