Skip to content

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

Merge branch 'chore/error-handling-refactor' into chore/all-requests-to-RQ

Joshen Lim7ec5d04e1840
diff --cc studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
index a67ff5f07ac,634bc2aaa0f..d5af40b525b
--- a/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
+++ b/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
@@@ -86,28 -84,42 +86,32 @@@ const ExitSurveyModal = ({ visible, onC
// If compute instance is present within the existing subscription, then a restart will be triggered
if (!projectRef) return console.error('Project ref is required')
- await updateSubscriptionTier({ projectRef, tier: 'tier_free' })
- resetCaptcha()
+ try {
+ await updateSubscriptionTier({ projectRef, tier: 'tier_free' })
+ resetCaptcha()
+ } catch (error) {
+ return
+ }
- try {
- const feedbackRes = await post(`${API_URL}/feedback/downgrade`, {
- projectRef,
- reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
- additionalFeedback: message,
- exitAction: 'downgrade',
- })
- if (feedbackRes.error) throw feedbackRes.error
- } catch (error: any) {
- return ui.setNotification({
- error,
- category: 'info',
- message: `Failed to submit exit survey: ${error.message}`,
- })
- } finally {
- ui.setNotification({
- category: 'success',
- duration: hasComputeInstance ? 8000 : 4000,
- message: hasComputeInstance
- ? 'Your project has been downgraded and is currently restarting to update its instance size'
- : 'Successfully downgraded project to the free plan',
- })
- if (hasComputeInstance) {
- setProjectStatus(queryClient, projectRef, PROJECT_STATUS.RESTORING)
- router.push(`/project/${projectRef}`)
- }
- onClose(true)
- window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
+ await sendExitSurvey({
+ projectRef,
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ message,
+ })
+
+ ui.setNotification({
+ category: 'success',
+ duration: hasComputeInstance ? 8000 : 4000,
+ message: hasComputeInstance
+ ? 'Your project has been downgraded and is currently restarting to update its instance size'
+ : 'Successfully downgraded project to the free plan',
+ })
+ if (hasComputeInstance) {
+ setProjectStatus(queryClient, projectRef, PROJECT_STATUS.RESTORING)
+ router.push(`/project/${projectRef}`)
}
+ onClose(true)
+ window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
return (