MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / useSelectedInfo

Function useSelectedInfo

app/hooks/useSelectedInfo.tsx:7–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { useJsonColumnViewState } from "./useJsonColumnView";
6
7export 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}

Callers 4

InfoPanelFunction · 0.90
CopySelectedNodeShortcutFunction · 0.90
PropertiesValueFunction · 0.90
PreviewValueFunction · 0.90

Calls 2

useJsonColumnViewStateFunction · 0.90
useJsonFunction · 0.90

Tested by

no test coverage detected