fix: add conditional rendering for payment data in credit packages
This commit is contained in:
parent
48c045fb73
commit
c94784e711
@ -37,6 +37,7 @@ export function CreditPackages() {
|
|||||||
const currentPlan = paymentData?.currentPlan;
|
const currentPlan = paymentData?.currentPlan;
|
||||||
|
|
||||||
// Get credit packages with translations - must be called here to maintain hook order
|
// Get credit packages with translations - must be called here to maintain hook order
|
||||||
|
// This function contains useTranslations hook, so it must be called before any conditional returns
|
||||||
const creditPackages = Object.values(getCreditPackages()).filter(
|
const creditPackages = Object.values(getCreditPackages()).filter(
|
||||||
(pkg) => !pkg.disabled && pkg.price.priceId
|
(pkg) => !pkg.disabled && pkg.price.priceId
|
||||||
);
|
);
|
||||||
@ -46,6 +47,11 @@ export function CreditPackages() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't render anything if we don't have payment data yet
|
||||||
|
if (!paymentData) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if user is on free plan and enablePackagesForFreePlan is false
|
// Check if user is on free plan and enablePackagesForFreePlan is false
|
||||||
const isFreePlan = currentPlan?.isFree === true;
|
const isFreePlan = currentPlan?.isFree === true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user