()
| 5 | import { useJsonColumnViewState } from "./useJsonColumnView"; |
| 6 | |
| 7 | export function useSelectedInfo(): JSONValueType | undefined { |
| 8 | const { selectedNodeId } = useJsonColumnViewState(); |
| 9 | |
| 10 | if (!selectedNodeId) { |
| 11 | return; |
| 12 | } |
| 13 | |
| 14 | const [json] = useJson(); |
| 15 | |
| 16 | return useMemo(() => { |
| 17 | const heroPath = new JSONHeroPath(selectedNodeId); |
| 18 | const selectedJson = heroPath.first(json); |
| 19 | return inferType(selectedJson); |
| 20 | }, [json, selectedNodeId]); |
| 21 | } |
no test coverage detected