Skip to content

Commit 02a6ba9

Browse files
committed
fix: undefined (reading 'name') on billing page
Because of plansInfo.get(), aggregationBillingPlan was undefined for custom plans since they were not part of the billing.getPlansInfo() result. Instead, use the currentPlan that is already fetched from the parent layout.
1 parent ffd5862 commit 02a6ba9

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/routes/(console)/organization-[organization]/billing/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
<Typography.Title>Billing</Typography.Title>
131131
<PlanSummary
132132
availableCredit={data?.availableCredit}
133-
currentPlan={data?.aggregationBillingPlan}
133+
currentPlan={data?.currentPlan}
134134
currentAggregation={data?.billingAggregation}
135135
currentInvoice={data?.billingInvoice} />
136136
<PaymentHistory />

src/routes/(console)/organization-[organization]/billing/+page.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { PageLoad } from './$types';
77
import { isCloud } from '$lib/system';
88

99
export const load: PageLoad = async ({ parent, depends }) => {
10-
const { organization, scopes, currentPlan, countryList, locale, plansInfo } = await parent();
10+
const { organization, scopes, currentPlan, countryList, locale } = await parent();
1111

1212
if (!scopes.includes('billing.read')) {
1313
return redirect(301, `/console/organization-${organization.$id}`);
@@ -64,18 +64,13 @@ export const load: PageLoad = async ({ parent, depends }) => {
6464
areCreditsSupported ? sdk.forConsole.billing.getAvailableCredit(organization.$id) : null
6565
]);
6666

67-
const aggregationBillingPlan = plansInfo.get(
68-
billingAggregation?.plan ?? organization.billingPlan
69-
);
70-
7167
// make number
7268
const credits = availableCredit ? availableCredit.available : null;
7369

7470
return {
7571
paymentMethods,
7672
addressList,
7773
billingAddress,
78-
aggregationBillingPlan,
7974
availableCredit: credits,
8075
billingAggregation,
8176
billingInvoice,

0 commit comments

Comments
 (0)