From 91030f348a8f654c21531c651924370345dce1c7 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:31:12 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- examples/experimental/nodes/frontend/src/App.tsx | 8 ++++---- .../nodes/frontend/src/hooks/useFileSystems.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/experimental/nodes/frontend/src/App.tsx b/examples/experimental/nodes/frontend/src/App.tsx index 698d947a..66f5fbc7 100644 --- a/examples/experimental/nodes/frontend/src/App.tsx +++ b/examples/experimental/nodes/frontend/src/App.tsx @@ -41,7 +41,7 @@ const App: React.FC = () => { addFile, setActiveFile } = useFileSystem(); - + // State for various components and messages const [messages, setMessages] = useState>([]); const [terminalMessages, setTerminalMessages] = useState([]); @@ -123,10 +123,10 @@ 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); @@ -134,7 +134,7 @@ const App: React.FC = () => { // Add new file addFile(filePath, fileContent); } - + setActiveFile(filePath); setActiveTab('editor'); setActivePanel('fileSystem'); diff --git a/examples/experimental/nodes/frontend/src/hooks/useFileSystems.ts b/examples/experimental/nodes/frontend/src/hooks/useFileSystems.ts index 26a440a7..b659e317 100644 --- a/examples/experimental/nodes/frontend/src/hooks/useFileSystems.ts +++ b/examples/experimental/nodes/frontend/src/hooks/useFileSystems.ts @@ -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, @@ -133,4 +133,4 @@ export const useFileSystem = () => { addFile, setActiveFile }; -}; \ No newline at end of file +};