From 66f0f53d1e5bbceacc8b18b3b5f9f587a6cbe13e Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Thu, 1 May 2025 21:56:35 -0500 Subject: [PATCH] fixed campaign analyitics --- frontend/src/hooks/emailCampaignHooks.js | 5 +++-- frontend/src/pages/Admin/CampaignAnalyticsPage.jsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/hooks/emailCampaignHooks.js b/frontend/src/hooks/emailCampaignHooks.js index 6022cf3..14a250b 100644 --- a/frontend/src/hooks/emailCampaignHooks.js +++ b/frontend/src/hooks/emailCampaignHooks.js @@ -246,7 +246,8 @@ export const useCampaignSubscriberActivity = ( page = 0, pageSize = 25, searchTerm = '', - activityType = 'all' + activityType = 'all', + tabValue ) => { return useQuery({ queryKey: ['campaign-activity', campaignId, page, pageSize, searchTerm, activityType], @@ -264,7 +265,7 @@ export const useCampaignSubscriberActivity = ( ); return response.data; }, - enabled: !!campaignId && tabValue === 2 // Only fetch when on the activity tab + enabled: !!campaignId && tabValue === 2 }); }; diff --git a/frontend/src/pages/Admin/CampaignAnalyticsPage.jsx b/frontend/src/pages/Admin/CampaignAnalyticsPage.jsx index 62531e8..b20ac6d 100644 --- a/frontend/src/pages/Admin/CampaignAnalyticsPage.jsx +++ b/frontend/src/pages/Admin/CampaignAnalyticsPage.jsx @@ -90,7 +90,7 @@ const CampaignAnalyticsPage = () => { isLoading: activityLoading, error: activityError } = useCampaignSubscriberActivity( - id, page, rowsPerPage, searchTerm, activityTypeFilter + id, page, rowsPerPage, searchTerm, activityTypeFilter, tabValue ); // Export report mutation