diff --git a/understand-anything-plugin/packages/dashboard/src/components/FileExplorer.tsx b/understand-anything-plugin/packages/dashboard/src/components/FileExplorer.tsx index 40a0b71..a0697d1 100644 --- a/understand-anything-plugin/packages/dashboard/src/components/FileExplorer.tsx +++ b/understand-anything-plugin/packages/dashboard/src/components/FileExplorer.tsx @@ -141,9 +141,17 @@ function FileTreeRow({ export default function FileExplorer() { const graph = useDashboardStore((s) => s.graph); const openCodeViewer = useDashboardStore((s) => s.openCodeViewer); + const navigateToNode = useDashboardStore((s) => s.navigateToNode); const entries = useMemo(() => buildFileTree(graph?.nodes ?? []), [graph]); const [expanded, setExpanded] = useState>(() => new Set()); + // Navigate the graph first (drills into layer + selects node, which clears the + // code viewer), then re-open the viewer so the source panel stays visible. + const handleOpenFile = (nodeId: string) => { + navigateToNode(nodeId); + openCodeViewer(nodeId); + }; + const toggleFolder = (folderPath: string) => { setExpanded((current) => { const next = new Set(current); @@ -194,7 +202,7 @@ export default function FileExplorer() { depth={0} expanded={expanded} toggleFolder={toggleFolder} - openFile={openCodeViewer} + openFile={handleOpenFile} /> )) )}