Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
akhatua2 committed Jan 13, 2025
1 parent 5a537f4 commit 36c1d88
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions frontend/hooks/useFileSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,11 @@ export const useFileSystem = () => {

// If we're at the last segment, it's a file
if (index === segments.length - 1) {
// Check if the file already exists
if (!existingFiles.has(currentPath)) {
currentLevel.push({
name: segment,
type: 'file',
path: currentPath
});
}
currentLevel.push({
name: segment,
type: 'file',
path: currentPath
});
} else {
// It's a folder
let folder = currentLevel.find(
Expand Down Expand Up @@ -223,8 +220,8 @@ export const useFileSystem = () => {

// Update the file system state while preserving existing file contents
setFileSystem(prev => ({
...prev,
tree: newTree
tree: newTree,
files: prev.files // Preserve all existing file contents
}));
};

Expand Down

0 comments on commit 36c1d88

Please sign in to comment.