From 2a6dbc729f3229b89da3c9f04c2997a0b292ba67 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 22 May 2025 16:31:25 -0700 Subject: [PATCH] fix(billing): fix error when currentPlan or organization is undefined When going from /account to /organization/[organization]/change-plan, the currentPlan and organization variables may not be defined as the states are still being set. This change ensures an error isn't thrown so that the states can update fully. --- .../organization-[organization]/change-plan/+page.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index 2f63c5532..ae83f8c26 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -241,9 +241,9 @@ } } - $: isUpgrade = $plansInfo.get(selectedPlan).order > $currentPlan.order; - $: isDowngrade = $plansInfo.get(selectedPlan).order < $currentPlan.order; - $: isButtonDisabled = $organization.billingPlan === selectedPlan; + $: isUpgrade = $plansInfo.get(selectedPlan).order > $currentPlan?.order; + $: isDowngrade = $plansInfo.get(selectedPlan).order < $currentPlan?.order; + $: isButtonDisabled = $organization?.billingPlan === selectedPlan;