From 89baec8ac8ca686edeb440b1b2c5f05fd13e2c8d Mon Sep 17 00:00:00 2001 From: Ben White Date: Wed, 30 Oct 2024 14:28:29 +0100 Subject: [PATCH] Fix billing logic to only load if logged in as a user --- frontend/src/scenes/billing/billingLogic.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/scenes/billing/billingLogic.tsx b/frontend/src/scenes/billing/billingLogic.tsx index 8eae5896563c1..478b36897e387 100644 --- a/frontend/src/scenes/billing/billingLogic.tsx +++ b/frontend/src/scenes/billing/billingLogic.tsx @@ -100,7 +100,7 @@ export const billingLogic = kea([ setComputedDiscount: (discount: number) => ({ discount }), }), connect(() => ({ - values: [featureFlagLogic, ['featureFlags'], preflightLogic, ['preflight']], + values: [featureFlagLogic, ['featureFlags'], preflightLogic, ['preflight'], userLogic, ['user']], actions: [ userLogic, ['loadUser'], @@ -690,9 +690,11 @@ export const billingLogic = kea([ } }, })), - afterMount(({ actions }) => { - actions.loadBilling() - actions.getInvoices() + afterMount(({ actions, values }) => { + if (values.user) { + actions.loadBilling() + actions.getInvoices() + } }), urlToAction(({ actions }) => ({ // IMPORTANT: This needs to be above the "*" so it takes precedence