From 6ba5758d307d23728fd94f115588203e3e908220 Mon Sep 17 00:00:00 2001 From: dotta Date: Wed, 18 Mar 2026 14:32:04 -0500 Subject: [PATCH] Fix file selection being reset when clicking entry file in tree The useEffect that syncs selectedFile was resetting to an existing file whenever the selected path wasn't in the bundle's on-disk file list. This prevented selecting the entry file (e.g. AGENTS.md) when it didn't yet exist on disk, even though it was visible in the file tree. Allow selecting the currentEntryFile even when it has no on-disk file. Co-Authored-By: Paperclip --- ui/src/pages/AgentDetail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/pages/AgentDetail.tsx b/ui/src/pages/AgentDetail.tsx index 621eb284..40c08ca8 100644 --- a/ui/src/pages/AgentDetail.tsx +++ b/ui/src/pages/AgentDetail.tsx @@ -1636,7 +1636,7 @@ function PromptsTab({ if (selectedFile !== bundle.entryFile) setSelectedFile(bundle.entryFile); return; } - if (!availablePaths.includes(selectedFile)) { + if (!availablePaths.includes(selectedFile) && selectedFile !== currentEntryFile) { setSelectedFile(availablePaths.includes(bundle.entryFile) ? bundle.entryFile : availablePaths[0]!); } }, [bundle, bundleMatchesDraft, currentEntryFile, selectedFile]);