diff --git a/frontend/src/components/Layout.js b/frontend/src/components/Layout.js index e766de5..97df9e8 100644 --- a/frontend/src/components/Layout.js +++ b/frontend/src/components/Layout.js @@ -4,10 +4,12 @@ import Header from './Header'; import Sidebar from './Sidebar'; import MainContent from './MainContent'; import { useFileNavigation } from '../hooks/useFileNavigation'; +import { useFileList } from '../hooks/useFileList'; const Layout = () => { const { selectedFile, handleFileSelect, handleLinkClick } = useFileNavigation(); + const { files, loadFileList } = useFileList(); return ( @@ -27,11 +29,14 @@ const Layout = () => { diff --git a/frontend/src/components/MainContent.js b/frontend/src/components/MainContent.js index 08d71ef..177f538 100644 --- a/frontend/src/components/MainContent.js +++ b/frontend/src/components/MainContent.js @@ -12,7 +12,12 @@ import { useFileOperations } from '../hooks/useFileOperations'; import { useGitOperations } from '../hooks/useGitOperations'; import { useSettings } from '../contexts/SettingsContext'; -const MainContent = ({ selectedFile, handleFileSelect, handleLinkClick }) => { +const MainContent = ({ + selectedFile, + handleFileSelect, + handleLinkClick, + loadFileList, +}) => { const [activeTab, setActiveTab] = useState('source'); const { settings } = useSettings(); const { @@ -43,20 +48,22 @@ const MainContent = ({ selectedFile, handleFileSelect, handleLinkClick }) => { async (fileName) => { const success = await handleCreate(fileName); if (success) { + loadFileList(); handleFileSelect(fileName); } }, - [handleCreate, handleFileSelect] + [handleCreate, handleFileSelect, loadFileList] ); const handleDeleteFile = useCallback( async (filePath) => { const success = await handleDelete(filePath); if (success) { + loadFileList(); handleFileSelect(null); } }, - [handleDelete, handleFileSelect] + [handleDelete, handleFileSelect, loadFileList] ); const renderBreadcrumbs = useMemo(() => { diff --git a/frontend/src/components/Sidebar.js b/frontend/src/components/Sidebar.js index bd657c0..79271f7 100644 --- a/frontend/src/components/Sidebar.js +++ b/frontend/src/components/Sidebar.js @@ -2,18 +2,16 @@ import React, { useEffect } from 'react'; import { Box } from '@mantine/core'; import FileActions from './FileActions'; import FileTree from './FileTree'; -import { useFileList } from '../hooks/useFileList'; import { useGitOperations } from '../hooks/useGitOperations'; import { useSettings } from '../contexts/SettingsContext'; -const Sidebar = ({ selectedFile, handleFileSelect }) => { +const Sidebar = ({ selectedFile, handleFileSelect, files, loadFileList }) => { const { settings } = useSettings(); - const { files, loadFileList } = useFileList(); const { handlePull } = useGitOperations(settings.gitEnabled); useEffect(() => { loadFileList(); - }, [settings.gitEnabled, loadFileList]); + }, [loadFileList]); return (