diff --git a/frontend/src/pages/Reports.jsx b/frontend/src/pages/Reports.jsx index bc2fee3..37c4838 100644 --- a/frontend/src/pages/Reports.jsx +++ b/frontend/src/pages/Reports.jsx @@ -127,12 +127,19 @@ const Reports = () => { } finally { setLoading(false); } - }, [activeTab, year, months]); + }, [activeTab, year, months, selectedCategory]); useEffect(() => { loadData(); }, [loadData]); + // Recarrega dados quando categoria selecionada muda + useEffect(() => { + if (activeTab === 'category') { + loadData(); + } + }, [selectedCategory]); + const tabs = [ { id: 'summary', label: t('reports.summary'), icon: 'bi-clipboard-data' }, { id: 'category', label: t('reports.byCategory'), icon: 'bi-pie-chart' }, @@ -447,12 +454,10 @@ const Reports = () => { const handleCategoryClick = (cat) => { setSelectedCategory(cat); - loadData(); }; const handleBackToCategories = () => { setSelectedCategory(null); - loadData(); }; return (