From 7e58e97b5a89d076b5e58bdb962bb4821a05e7ad Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Fri, 1 May 2026 17:55:56 +0800 Subject: [PATCH] feat(dashboard): file double-click also navigates the graph Double-clicking a file in the Files tab previously only opened the source viewer; the graph stayed wherever it was. Now also calls navigateToNode first (drills into the layer + selects the node), then re-opens the code viewer so the source panel stays visible. Order matters: navigateToNodeInLayer resets codeViewerOpen, so the openCodeViewer call has to come after. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../packages/dashboard/src/components/FileExplorer.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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} /> )) )}