Skip to content

useDiagnostics

useDiagnostics(options?): DiagnosticsResult

Defined in: console-sdk/src/react/hooks/useDiagnostics.ts:115

Reactive dev diagnostics: the bounded raw-packet ring, its parse-success rate, and a clear() action (SDK_PLAN.md §3.6.8). Requires config.diagnostics.rawPackets: true; returns the empty state otherwise. Throws OutsideProviderError when no <ConsoleProvider> is above the caller.

The ring is frame-coalesced in the store, so even a high-throughput console re-renders a diagnostics screen at most once per animation frame.

DiagnosticsOptions

optional capacity to cap the returned view to the newest N packets (never enlarges the SDK’s ring).

DiagnosticsResult

the visible packets, their parse-success rate, and clear().

const { packets, parseSuccessRate, clear } = useDiagnostics({ capacity: 100 });
// requires createConsoleConfig({ diagnostics: { rawPackets: true } })