Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Nov 22, 2024
1 parent 5fe47ab commit 91030f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions examples/experimental/nodes/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const App: React.FC = () => {
addFile,
setActiveFile
} = useFileSystem();

// State for various components and messages
const [messages, setMessages] = useState<Array<{text: string, type: 'message' | 'status'}>>([]);
const [terminalMessages, setTerminalMessages] = useState<string[]>([]);
Expand Down Expand Up @@ -123,18 +123,18 @@ const App: React.FC = () => {
// Handle file writing
const filePath = messageData.data.path;
const fileContent = messageData.data.argument;

// Check if file already exists in openFiles
const existingFileIndex = openFiles.findIndex(f => f.path === filePath);

if (existingFileIndex !== -1) {
// Update existing file content
handleFileChange(filePath, fileContent);
} else {
// Add new file
addFile(filePath, fileContent);
}

setActiveFile(filePath);
setActiveTab('editor');
setActivePanel('fileSystem');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ export const useFileSystem = () => {
...prev.files,
[path]: content
};

const pathParts = path.split('/').filter(Boolean);
const fileName = pathParts[pathParts.length - 1];

const updatedTree = [...prev.tree];
const workspaceFolder = updatedTree.find(node => node.name === 'workspace');
if (workspaceFolder && workspaceFolder.children) {
const fileExists = workspaceFolder.children.some(child => child.path === path);

if (!fileExists) {
const newFileNode: FileNode = {
name: fileName,
Expand Down Expand Up @@ -133,4 +133,4 @@ export const useFileSystem = () => {
addFile,
setActiveFile
};
};
};

0 comments on commit 91030f3

Please sign in to comment.