From eceec5b3e0f85e7de55feab0f17505a9c5846667 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 17 Mar 2025 06:11:20 +0000 Subject: [PATCH] use derived store instead --- src/lib/stores/billing.ts | 3 +-- .../organization-[organization]/billing/budgetCap.svelte | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 353f1a933..31200bf57 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -65,7 +65,7 @@ export const plansInfo = derived(page, ($page) => $page.data.plansInfo as PlansM export const daysLeftInTrial = writable(0); export const readOnly = writable(false); -export const showBudgetAlert = writable(false); +export const showBudgetAlert = derived(page, ($page) => ($page.data.organization?.billingLimits.budgetLimit ?? 0) >= 100); export function getRoleLabel(role: string) { return roles.find((r) => r.value === role)?.label ?? role; @@ -279,7 +279,6 @@ export async function checkForUsageLimit(org: Organization) { return; } - showBudgetAlert.set(true); headerAlert.add({ id: 'budgetLimit', component: BudgetLimitAlert, diff --git a/src/routes/(console)/organization-[organization]/billing/budgetCap.svelte b/src/routes/(console)/organization-[organization]/billing/budgetCap.svelte index 55c19c50e..5fdc358e2 100644 --- a/src/routes/(console)/organization-[organization]/billing/budgetCap.svelte +++ b/src/routes/(console)/organization-[organization]/billing/budgetCap.svelte @@ -27,7 +27,6 @@ $organization.budgetAlerts ); await invalidate(Dependencies.ORGANIZATION); - showBudgetAlert.set(false); addNotification({ type: 'success', isHtml: true,