From ead6672d21ea13b31091601188b57587f9d975f2 Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Fri, 2 May 2025 22:47:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=97=A0=E6=95=88=E5=9C=B0=E5=9D=80=E6=97=B6=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E9=99=90=E5=BE=AA=E7=8E=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/composables/useSftpActions.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/composables/useSftpActions.ts b/packages/frontend/src/composables/useSftpActions.ts index e1524a8..56a72dc 100644 --- a/packages/frontend/src/composables/useSftpActions.ts +++ b/packages/frontend/src/composables/useSftpActions.ts @@ -232,7 +232,7 @@ export function createSftpActionsManager( console.log(`[SFTP ${instanceSessionId}] ${forceRefresh ? '强制' : ''}加载目录: ${path}`); // 日志改为中文,并标明是否强制 isLoading.value = true; // error.value = null; // 不再需要 - currentPathRef.value = path; // 更新外部 ref + // currentPathRef.value = path; // <-- 移除此行,延迟更新 const requestId = generateRequestId(); loadingRequestId.value = requestId; // 记录当前加载请求 ID sendMessage({ type: 'sftp:readdir', requestId: requestId, payload: { path } }); @@ -537,6 +537,10 @@ export function createSftpActionsManager( targetNode.childrenLoaded = true; console.log(`[SFTP ${instanceSessionId}] File tree node ${path}'s children updated after merge.`); + // *** 在成功加载并更新树之后,才更新当前路径 *** + currentPathRef.value = path; + console.log(`[SFTP ${instanceSessionId}] currentPathRef updated to ${path} after successful readdir.`); + // 重置加载状态,因为这是匹配的响应 isLoading.value = false; loadingRequestId.value = null;