fix: 修复输入无效地址时导致的无限循环问题
This commit is contained in:
@@ -232,7 +232,7 @@ export function createSftpActionsManager(
|
|||||||
console.log(`[SFTP ${instanceSessionId}] ${forceRefresh ? '强制' : ''}加载目录: ${path}`); // 日志改为中文,并标明是否强制
|
console.log(`[SFTP ${instanceSessionId}] ${forceRefresh ? '强制' : ''}加载目录: ${path}`); // 日志改为中文,并标明是否强制
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
// error.value = null; // 不再需要
|
// error.value = null; // 不再需要
|
||||||
currentPathRef.value = path; // 更新外部 ref
|
// currentPathRef.value = path; // <-- 移除此行,延迟更新
|
||||||
const requestId = generateRequestId();
|
const requestId = generateRequestId();
|
||||||
loadingRequestId.value = requestId; // 记录当前加载请求 ID
|
loadingRequestId.value = requestId; // 记录当前加载请求 ID
|
||||||
sendMessage({ type: 'sftp:readdir', requestId: requestId, payload: { path } });
|
sendMessage({ type: 'sftp:readdir', requestId: requestId, payload: { path } });
|
||||||
@@ -537,6 +537,10 @@ export function createSftpActionsManager(
|
|||||||
targetNode.childrenLoaded = true;
|
targetNode.childrenLoaded = true;
|
||||||
console.log(`[SFTP ${instanceSessionId}] File tree node ${path}'s children updated after merge.`);
|
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;
|
isLoading.value = false;
|
||||||
loadingRequestId.value = null;
|
loadingRequestId.value = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user