Skip to content

The open source coding agent.

TypeScript

zen: fix billing button

Frankf8a1a0b26fee
diff --git a/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
index 05f8edd0178..fe4e08b7cb7 100644
--- a/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
@@ -34,10 +34,17 @@ export function BillingSection() {
const sessionSubmission = useSubmission(createSessionUrl)
const [store, setStore] = createStore({
showAddBalanceForm: false,
- addBalanceAmount: "",
+ addBalanceAmount: billingInfo()?.reloadAmount.toString() ?? "",
checkoutRedirecting: false,
sessionRedirecting: false,
})
+
+ createEffect(() => {
+ const info = billingInfo()
+ if (info) {
+ setStore("addBalanceAmount", info.reloadAmount.toString())
+ }
+ })
const balance = createMemo(() => formatBalance(billingInfo()?.balance ?? 0))
async function onClickCheckout() {
@@ -67,7 +74,6 @@ export function BillingSection() {
}
setStore({
showAddBalanceForm: true,
- addBalanceAmount: billingInfo()!.reloadAmount.toString(),
})
}