From a73b016def02729671f8a87d740296bd866169a9 Mon Sep 17 00:00:00 2001 From: cmliu Date: Fri, 31 Jul 2026 04:06:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A1=AE=E4=BF=9D=E5=9C=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=A0=91=E6=97=B6=E5=B1=95=E5=BC=80=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=BB=A5=E6=B8=B2=E6=9F=93=E5=85=B6=E5=AD=90?= =?UTF-8?q?=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/file-tree.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/file-tree.ts b/frontend/src/file-tree.ts index e00f49a..dbacae5 100644 --- a/frontend/src/file-tree.ts +++ b/frontend/src/file-tree.ts @@ -604,7 +604,17 @@ export class FileTree { for (const segment of segments) { if (token !== this.setCwdToken) return; - if (segment === current.path) continue; + if (segment === current.path) { + // Even when the segment matches the current node (e.g. root "/" on + // initial load or setCwd("/")), we must still expand it so its + // children are rendered in the tree. Without this, clicking the root + // loads the right panel but the left tree stays collapsed. + if (current.state !== 'expanded') { + await this.expandNode(current, true); + if (token !== this.setCwdToken) return; + } + continue; + } // If current is unavailable, we can't see its real children. // Create a synthetic child for the next segment so the walk can