Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions apps/frontend/src/components/DonorStatsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function DonorStatsChart() {
const [isLoading, setIsLoading] = React.useState(false);
const [error, setError] = React.useState<string | null>(null);

// Fetch data whenever activeChart, quantity, or unit changes
// Fetch data whenever quantity or unit changes
React.useEffect(() => {
const fetchData = async () => {
setIsLoading(true);
Expand All @@ -181,12 +181,6 @@ export function DonorStatsChart() {

setDonationsData(donationsProcessed);
setRecurringDonorsData(recurringDonorsProcessed);

if (activeChart === 'donations') {
setChartData(donationsProcessed);
} else {
setChartData(recurringDonorsProcessed);
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to load data');
setChartData([]);
Expand All @@ -196,7 +190,7 @@ export function DonorStatsChart() {
};

fetchData();
}, [activeChart, quantity, unit]);
}, [quantity, unit]);

// Update chart data when activeChart changes
React.useEffect(() => {
Expand Down
Loading