dev-1.7.0 #294

Merged
ZacharyZcR merged 73 commits from main into dev-1.7.0 2025-09-25 04:56:32 +00:00
Showing only changes of commit 2060b75dd3 - Show all commits
@@ -151,9 +151,17 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
} }
}, [currentHost]); }, [currentHost]);
// File list update // Track if initial directory load is done to prevent duplicate loading
const initialLoadDoneRef = useRef(false);
// File list update - only reload when path changes, not on initial connection
useEffect(() => { useEffect(() => {
if (sshSessionId) { if (sshSessionId && currentPath) {
// Skip the first load since it's handled in initializeSSHConnection
if (!initialLoadDoneRef.current) {
initialLoadDoneRef.current = true;
return;
}
handleRefreshDirectory(); handleRefreshDirectory();
} }
}, [sshSessionId, currentPath]); }, [sshSessionId, currentPath]);
@@ -203,6 +211,8 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
try { try {
setIsLoading(true); setIsLoading(true);
// Reset initial load flag for new connections
initialLoadDoneRef.current = false;
const sessionId = currentHost.id.toString(); const sessionId = currentHost.id.toString();
@@ -220,6 +230,21 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
}); });
setSshSessionId(sessionId); setSshSessionId(sessionId);
// Load initial directory immediately after connection to prevent jarring transition
try {
console.log("Loading initial directory:", currentPath);
const response = await listSSHFiles(sessionId, currentPath);
const files = Array.isArray(response) ? response : response?.files || [];
console.log("Initial directory loaded successfully:", files.length, "items");
setFiles(files);
clearSelection();
// Mark initial load as completed
initialLoadDoneRef.current = true;
} catch (dirError: any) {
console.error("Failed to load initial directory:", dirError);
// Don't show error toast here as it will be handled by the useEffect retry
}
} catch (error: any) { } catch (error: any) {
console.error("SSH connection failed:", error); console.error("SSH connection failed:", error);
toast.error( toast.error(