diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 99e7a8a..a5bedda 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -261,7 +261,7 @@ const Index = () => { const userFromAuth = AuthService.getUser(); if (userFromAuth) { setUser(userFromAuth); - loadNotes(); + loadNotes(); // Will use current showArchived state loadTodos(); loadRssFeeds(); loadRssArticles(); @@ -269,7 +269,14 @@ const Index = () => { } else { navigate("/login"); } - }, [navigate]); + }, [navigate]); // Keep this for auth check + + // Reload notes when showArchived changes + useEffect(() => { + if (user) { + loadNotes(); + } + }, [showArchived]); // Auto-refresh des articles RSS toutes les 2 minutes useEffect(() => { @@ -296,7 +303,7 @@ const Index = () => { const loadNotes = async () => { try { - const fetchedNotes = await NotesService.getNotes(); + const fetchedNotes = await NotesService.getNotes(showArchived); if (Array.isArray(fetchedNotes)) { setNotes(fetchedNotes); } diff --git a/src/pages/mobile/NotesPage.tsx b/src/pages/mobile/NotesPage.tsx index 22b1d7a..a3dbcb4 100644 --- a/src/pages/mobile/NotesPage.tsx +++ b/src/pages/mobile/NotesPage.tsx @@ -33,7 +33,7 @@ export default function NotesPage() { const loadNotes = async () => { try { - const data = await NotesService.getNotes(); + const data = await NotesService.getNotes(showArchived); setNotes(data); } catch (error) { showError("Erreur lors du chargement des notes"); @@ -42,7 +42,7 @@ export default function NotesPage() { useEffect(() => { loadNotes(); - }, []); + }, [showArchived]); // Extract unique tags from all notes const availableTags: TagOption[] = Array.from(