From 1d8458084a37316431adaa0b46de933ce483c8cb Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 22 May 2025 16:28:32 -0700 Subject: [PATCH 1/2] fix(support): fix upgrade URL for free organization Even though upgradeURL isn't used when there are no free orgs, this line is still evaluated and will throw an error because freeOrganization is undefined. This commit adds a null check to prevent this error. --- src/lib/components/support.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/support.svelte b/src/lib/components/support.svelte index 2520ef032e..d05d2639c3 100644 --- a/src/lib/components/support.svelte +++ b/src/lib/components/support.svelte @@ -28,7 +28,7 @@ (team) => !$plansInfo.get((team as Organization).billingPlan)?.premiumSupport ); - $: upgradeURL = `${base}/organization-${freeOrganization.$id}/change-plan`; + $: upgradeURL = `${base}/organization-${freeOrganization?.$id}/change-plan`; $: supportTimings = `${utcHourToLocaleHour('16:00')} - ${utcHourToLocaleHour('00:00')} ${localeShortTimezoneName()}`; From 2a6dbc729f3229b89da3c9f04c2997a0b292ba67 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 22 May 2025 16:31:25 -0700 Subject: [PATCH 2/2] 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 2f63c5532c..ae83f8c261 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;