Skip to content

Commit

Permalink
fix(RV-440): Fix file bug where prev files are displayed (#464)
Browse files Browse the repository at this point in the history
fix(RV-440): Fix file bug where prev files are displayed
  • Loading branch information
knguyenrise8 authored Dec 6, 2024
1 parent 86686c0 commit 38750a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '@testing-library/jest-dom';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { BrowserRouter } from 'react-router-dom';
import App from './App';
import { FilesProvider } from './contexts/FilesContext';

// Mock the imports
vi.mock('./components/AppHeader/AppHeader.tsx', () => ({
Expand All @@ -29,7 +30,9 @@ describe('App component', () => {
const renderComponent = () => {
render(
<BrowserRouter>
<App />
<FilesProvider>
<App />
</FilesProvider>
</BrowserRouter>
);
};
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { TemplatesIndex } from "./components/TemplatesIndex/TemplatesIndex.tsx";
import Comment from './assets/comment.svg';
import CSV from './assets/csv.svg';
import "./App.scss";
import { useFiles } from "./contexts/FilesContext.tsx";

function App() {
const { pathname } = useLocation();
const navigate = useNavigate();
const { setFiles } = useFiles();
const [isFirstVisit, setIsFirstVisit] = useState(false);

useEffect(() => {
Expand All @@ -20,6 +22,7 @@ function App() {
setIsFirstVisit(true);
localStorage.setItem("hasVisited", "true");
}
setFiles([]);
}, []);

const navLinks = [
Expand Down

0 comments on commit 38750a6

Please sign in to comment.