Skip to content

Commit eceec5b

Browse files
committed
use derived store instead
1 parent f4b9f32 commit eceec5b

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/lib/stores/billing.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const plansInfo = derived(page, ($page) => $page.data.plansInfo as PlansM
6565
export const daysLeftInTrial = writable<number>(0);
6666
export const readOnly = writable<boolean>(false);
6767

68-
export const showBudgetAlert = writable<boolean>(false);
68+
export const showBudgetAlert = derived(page, ($page) => ($page.data.organization?.billingLimits.budgetLimit ?? 0) >= 100);
6969

7070
export function getRoleLabel(role: string) {
7171
return roles.find((r) => r.value === role)?.label ?? role;
@@ -279,7 +279,6 @@ export async function checkForUsageLimit(org: Organization) {
279279
return;
280280
}
281281

282-
showBudgetAlert.set(true);
283282
headerAlert.add({
284283
id: 'budgetLimit',
285284
component: BudgetLimitAlert,

src/routes/(console)/organization-[organization]/billing/budgetCap.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
$organization.budgetAlerts
2828
);
2929
await invalidate(Dependencies.ORGANIZATION);
30-
showBudgetAlert.set(false);
3130
addNotification({
3231
type: 'success',
3332
isHtml: true,

0 commit comments

Comments
 (0)