Skip to content

Commit d1bda39

Browse files
fix: guard against null billing plan cache entries
1 parent eeea06d commit d1bda39

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/stores/billing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export function getBasePlanFromGroup(billingPlanGroup: BillingPlanGroup): Models
143143
const plansInfoStore = getPlansInfoStore();
144144

145145
const proPlans = Array.from(plansInfoStore.values()).filter(
146-
(plan) => plan.group === billingPlanGroup
146+
(plan): plan is Models.BillingPlan => !!plan && plan.group === billingPlanGroup
147147
);
148148

149149
return proPlans.sort((a, b) => a.order - b.order)[0];

src/routes/(console)/project-[region]-[project]/+layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
9999
loadFailedInvoices(project.teamId);
100100
}
101101

102-
if (!includedInBasePlans) {
102+
if (!includedInBasePlans && organizationPlan) {
103103
// save the custom plan to `plansInfo` cache.
104104
plansInfo.set(organization.billingPlanId, organizationPlan);
105105
}

0 commit comments

Comments
 (0)