From fbdb32d3db7a4e7b4c5c3470c75076ceaa7b72a0 Mon Sep 17 00:00:00 2001 From: Yunus A M Date: Wed, 18 Oct 2023 13:15:34 +0530 Subject: [PATCH] fix: remove useEffect and replace with onSuccess and fix remaining days bug --- .../container/BillingContainer/BillingContainer.tsx | 12 ++---------- frontend/src/utils/app.ts | 7 +------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/frontend/src/container/BillingContainer/BillingContainer.tsx b/frontend/src/container/BillingContainer/BillingContainer.tsx index 3e8d1478a6f..f5a35bbeae1 100644 --- a/frontend/src/container/BillingContainer/BillingContainer.tsx +++ b/frontend/src/container/BillingContainer/BillingContainer.tsx @@ -161,9 +161,7 @@ export default function BillingContainer(): JSX.Element { setTotalBillAmount(total); if (!licensesData?.payload?.onTrial) { - const remainingDays = getRemainingDays( - getRemainingDays(billingPeriodEnd) - 1, - ); + const remainingDays = getRemainingDays(billingPeriodEnd) - 1; setHeaderText( `Your current billing period is from ${getFormattedDate( @@ -177,7 +175,7 @@ export default function BillingContainer(): JSX.Element { [licensesData?.payload?.onTrial], ); - const { isLoading, data: usageData } = useQuery( + const { isLoading } = useQuery( [REACT_QUERY_KEY.GET_BILLING_USAGE, user?.userId], { queryFn: () => getUsage(activeLicense?.key || ''), @@ -209,12 +207,6 @@ export default function BillingContainer(): JSX.Element { } }, [isFetching, licensesData?.payload, licenseError]); - useEffect(() => { - if (!isLoading && usageData) { - processUsageData(usageData); - } - }, [isLoading, processUsageData, usageData]); - const columns: ColumnsType = [ { title: '', diff --git a/frontend/src/utils/app.ts b/frontend/src/utils/app.ts index 57aef95692b..55312a11dc8 100644 --- a/frontend/src/utils/app.ts +++ b/frontend/src/utils/app.ts @@ -23,10 +23,5 @@ export const checkVersionState = ( latestVersion: string, ): boolean => { const versionCore = currentVersion?.split('-')[0]; - - if (versionCore) { - return versionCore === latestVersion; - } - - return false; + return versionCore === latestVersion; };