fix: memoize date range in AnalyticsDashboard to prevent infinite refetch

This commit is contained in:
2026-05-07 20:31:49 +03:00
parent 5714f99cbe
commit c34c99d86a
+2 -2
View File
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useMemo } from 'react';
import { useAnalytics } from './useAnalytics';
import FunnelChart from './charts/FunnelChart';
import RevenueChart from './charts/RevenueChart';
@@ -33,7 +33,7 @@ const KpiCard = ({ label, value, sub }) => (
const AnalyticsDashboard = () => {
const [activeDays, setActiveDays] = useState(30);
const { from, to } = getRange(activeDays);
const { from, to } = useMemo(() => getRange(activeDays), [activeDays]);
const {
totalOrders, closedOrders, conversionRate,
totalRevenue, avgDeal,