MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / GraphTab

Function GraphTab

graph-ui/src/components/GraphTab.tsx:67–593  ·  view source on GitHub ↗
({ project }: GraphTabProps)

Source from the content-addressed store, hash-verified

65}
66
67export function GraphTab({ project }: GraphTabProps) {
68 const { data, loading, error, progress, fetchOverview } = useGraphData();
69 const [highlightedIds, setHighlightedIds] = useState<Set<number> | null>(null);
70 const [selectedPath, setSelectedPath] = useState<string | null>(null);
71 const [selectedNode, setSelectedNode] = useState<GraphNode | null>(null);
72 const [cameraTarget, setCameraTarget] = useState<CameraTarget | null>(null);
73 const [repoInfo, setRepoInfo] = useState<RepoInfo | null>(null);
74 const [showLabels, setShowLabels] = useState(true);
75 const [display, setDisplay] = useState<DisplaySettings>(() =>
76 loadDisplaySettings(),
77 );
78 const updateDisplay = useCallback((next: DisplaySettings) => {
79 setDisplay(next);
80 saveDisplaySettings(next);
81 }, []);
82 const [leftWidth, setLeftWidth] = useState(() => loadWidth("cbm-left-w", 260));
83 const [rightWidth, setRightWidth] = useState(() => loadWidth("cbm-right-w", 280));
84 const limitNotice = formatGraphLimitNotice(data);
85
86 /* Node budget — keyed to its project so switching projects re-reads the
87 * persisted value and triggers exactly one fetch. */
88 const [budget, setBudget] = useState<{ project: string | null; value: number }>(
89 { project: null, value: GRAPH_RENDER_NODE_LIMIT },
90 );
91 const [budgetDraft, setBudgetDraft] = useState(String(GRAPH_RENDER_NODE_LIMIT));
92
93 const commitBudget = useCallback(() => {
94 const parsed = clampNodeBudget(parseInt(budgetDraft, 10));
95 setBudgetDraft(String(parsed));
96 if (project && parsed !== budget.value) {
97 saveNodeBudget(project, parsed);
98 setBudget({ project, value: parsed });
99 }
100 }, [budgetDraft, project, budget.value]);
101
102 /* Filter state — all enabled by default */
103 const [enabledLabels, setEnabledLabels] = useState<Set<string>>(new Set());
104 const [enabledEdgeTypes, setEnabledEdgeTypes] = useState<Set<string>>(new Set());
105
106 /* Missed skeleton (#963): the file structure of files the indexer could
107 * not fully cover, shown as a white satellite cluster beside the code
108 * galaxy. Toggle only hides/shows it — the data rides along with every
109 * code-graph layout. */
110 const [showMissedSkeleton, setShowMissedSkeleton] = useState(true);
111
112 /* Dead-code view: recolor by status + status-based filters */
113 const [deadCodeView, setDeadCodeView] = useState(false);
114 const [showOnlyDead, setShowOnlyDead] = useState(false);
115 const [hideEntryPoints, setHideEntryPoints] = useState(false);
116 const [hideTests, setHideTests] = useState(false);
117
118 /* Initialize filters when data loads */
119 useEffect(() => {
120 if (!data) return;
121 const labels = new Set(data.nodes.map((n) => n.label));
122 const types = new Set(data.edges.map((e) => e.type));
123 for (const lp of data.linked_projects ?? []) {
124 for (const n of lp.nodes) labels.add(n.label);

Callers

nothing calls this directly

Calls 10

useGraphDataFunction · 0.90
loadDisplaySettingsFunction · 0.90
saveDisplaySettingsFunction · 0.90
clampNodeBudgetFunction · 0.90
computeCameraTargetFunction · 0.90
loadWidthFunction · 0.85
formatGraphLimitNoticeFunction · 0.85
saveNodeBudgetFunction · 0.85
loadNodeBudgetFunction · 0.85
saveWidthFunction · 0.85

Tested by

no test coverage detected