Skip to content

useDevices

useDevices(query?): readonly Device[]

Defined in: console-sdk/src/react/hooks/useDevices.ts:131

The unified device list (SDK_PLAN.md §3.6.2). Returns every known device — saved, nearby, and connected as facets of ONE record — filtered by the optional DeviceQuery and ordered by the deterministic, STABLE fleet ordering (connected → saved-not-connected → discovered-only; never live-RSSI-sorted, so rows never reorder under the user’s finger). The no-query default is the full list.

The array identity is stable across renders whenever the projection is unchanged, and the hook returns [] from the very first render (before hydration or any sighting), so it is safe to map immediately (§3.9.1). Throws OutsideProviderError when no <ConsoleProvider> is above the caller.

DeviceQuery

optional filter; omit for the full unified list.

readonly Device[]

the filtered, fleet-ordered device list — referentially stable while its contents are unchanged.

const devices = useDevices(); // full list
const machines = useDevices({ connected: true });