Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Change loading logic for when hcaptcha is involved in payment summary panel

Joshen Lim773403b4ab6d
diff --git a/package-lock.json b/package-lock.json
index 938bb21e236..d002b6210bb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -63417,7 +63417,7 @@
"uniforms-bootstrap4": "^3.6.2",
"uniforms-bridge-json-schema": "^3.6.2",
"uuid": "^8.3.2",
- "valtio": "*",
+ "valtio": "^1.7.6",
"yup": "^0.32.11",
"yup-password": "^0.2.2",
"zxcvbn": "^4.4.2"
diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsx
index f299c2308ce..2b3357df770 100644
--- a/studio/components/interfaces/Billing/ProUpgrade.tsx
+++ b/studio/components/interfaces/Billing/ProUpgrade.tsx
@@ -159,11 +159,16 @@ const ProUpgrade: FC<Props> = ({
}
const onConfirmPayment = async () => {
- let token = captchaToken
+ setIsSubmitting(true)
+
+ const token =
+ captchaToken ?? (await captchaRef.current?.execute({ async: true }))?.response ?? undefined
+
if (!token) {
- const captchaResponse = await captchaRef.current?.execute({ async: true })
- token = captchaResponse?.response ?? null
+ setIsSubmitting(false)
+ return
}
+
const payload = formSubscriptionUpdatePayload(
currentSubscription,
selectedTier,
@@ -173,8 +178,6 @@ const ProUpgrade: FC<Props> = ({
projectRegion,
token ?? undefined
)
-
- setIsSubmitting(true)
const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload)
resetCaptcha()