mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
15 lines
483 B
TypeScript
15 lines
483 B
TypeScript
import {useContext} from 'react';
|
|
|
|
import type {FlamegraphState} from '../flamegraphStateProvider/flamegraphContext';
|
|
import {FlamegraphStateValueContext} from '../flamegraphStateProvider/flamegraphContext';
|
|
|
|
export function useFlamegraphSearch(): FlamegraphState['search'] {
|
|
const context = useContext(FlamegraphStateValueContext);
|
|
|
|
if (context === null) {
|
|
throw new Error('useFlamegraphSearch called outside of FlamegraphStateProvider');
|
|
}
|
|
|
|
return context[0].search;
|
|
}
|