Fix critical file selection and SSH connection issues in modern file manager
Major fixes that make the modern file manager fully functional: 🔧 Core Issues Fixed: - File selection bug: All files showing as selected when only one was clicked - SSH connection not established: 400 errors when loading directories - File path undefined: Backend data missing proper path construction 🎯 File Selection Fix: - Root cause: All file.path values were 'undefined', causing path comparison to always return true ('undefined' === 'undefined') - Solution: Manually construct file paths from currentPath + fileName - Result: Proper single/multi/range selection now works correctly 🔗 SSH Connection Enhancement: - Added comprehensive connection status checking before operations - Implemented automatic reconnection on connection failures - Enhanced error handling with detailed logging and user feedback - Added connection parameter validation and debugging 🛠️ Technical Improvements: - Enhanced useFileSelection hook with safer state management - Added extensive debugging logs for file operations and path construction - Improved error messages and user feedback across all operations - Robust file path building matching traditional file manager logic The modern file manager now provides a fully functional, desktop-class file management experience with proper selection, navigation, and operations.
This commit is contained in:
@@ -68,6 +68,11 @@ export function useFileSelection() {
|
||||
return selectedFiles.length;
|
||||
}, [selectedFiles]);
|
||||
|
||||
const setSelection = useCallback((files: FileItem[]) => {
|
||||
console.log('Setting selection to:', files.map(f => f.name));
|
||||
setSelectedFiles(files);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
selectedFiles,
|
||||
selectFile,
|
||||
@@ -77,6 +82,6 @@ export function useFileSelection() {
|
||||
toggleSelection,
|
||||
isSelected,
|
||||
getSelectedCount,
|
||||
setSelectedFiles
|
||||
setSelection
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user