Skip to content

Commit

Permalink
fix: remove useEffect and replace with onSuccess and fix remaining da…
Browse files Browse the repository at this point in the history
…ys bug
  • Loading branch information
YounixM committed Oct 18, 2023
1 parent 665cf12 commit fbdb32d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
12 changes: 2 additions & 10 deletions frontend/src/container/BillingContainer/BillingContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 || ''),
Expand Down Expand Up @@ -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<DataType> = [
{
title: '',
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/utils/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit fbdb32d

Please sign in to comment.