Skip to content

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

Address comments

Joshen Lim5d8e1bb24dd3
diff --git a/studio/components/interfaces/Auth/Users/UserDropdown.tsx b/studio/components/interfaces/Auth/Users/UserDropdown.tsx
index 0f718cd44a9..5e98c377946 100644
--- a/studio/components/interfaces/Auth/Users/UserDropdown.tsx
+++ b/studio/components/interfaces/Auth/Users/UserDropdown.tsx
@@ -26,9 +26,30 @@ const UserDropdown = ({ user, canRemoveUser, canRemoveMFAFactors }: UserDropdown
const { ref } = useParams()
const PageState: any = useContext(PageContext)
- const { mutateAsync: resetPassword, isLoading: isResetting } = useUserResetPasswordMutation()
- const { mutateAsync: sendMagicLink, isLoading: isSendingLink } = useUserSendMagicLinkMutation()
- const { mutateAsync: sendOTP, isLoading: isSendingOTP } = useUserSendOTPMutation()
+ const { mutate: resetPassword, isLoading: isResetting } = useUserResetPasswordMutation({
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: `Sent password recovery to ${user.email}`,
+ })
+ },
+ })
+ const { mutate: sendMagicLink, isLoading: isSendingLink } = useUserSendMagicLinkMutation({
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: `Sent magic link to ${user.email}`,
+ })
+ },
+ })
+ const { mutate: sendOTP, isLoading: isSendingOTP } = useUserSendOTPMutation({
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: `Sent OTP to ${user.phone}`,
+ })
+ },
+ })
const { mutateAsync: deleteUser, isLoading: isDeleting } = useUserDeleteMutation()
const { mutateAsync: deleteUserMFAFactors, isLoading: isDeletingFactors } =
useUserDeleteMFAFactorsMutation()
@@ -36,29 +57,17 @@ const UserDropdown = ({ user, canRemoveUser, canRemoveMFAFactors }: UserDropdown
const handleResetPassword = async () => {
if (!ref) return console.error('Project ref is required')
- await resetPassword({ projectRef: ref, user })
- ui.setNotification({
- category: 'success',
- message: `Sent password recovery to ${user.email}`,
- })
+ resetPassword({ projectRef: ref, user })
}
async function handleSendMagicLink() {
if (!ref) return console.error('Project ref is required')
- await sendMagicLink({ projectRef: ref, user })
- ui.setNotification({
- category: 'success',
- message: `Sent magic link to ${user.email}`,
- })
+ sendMagicLink({ projectRef: ref, user })
}
async function handleSendOtp() {
if (!ref) return console.error('Project ref is required')
- await sendOTP({ projectRef: ref, user })
- ui.setNotification({
- category: 'success',
- message: `Sent OTP to ${user.phone}`,
- })
+ sendOTP({ projectRef: ref, user })
}
async function handleDelete() {
@@ -68,10 +77,13 @@ const UserDropdown = ({ user, canRemoveUser, canRemoveMFAFactors }: UserDropdown
message: `This is permanent! Are you sure you want to delete user ${user.email} ?`,
onAsyncConfirm: async () => {
if (!ref) return console.error('Project ref is required')
- await deleteUser({ projectRef: ref, user })
- ui.setNotification({ category: 'success', message: `Successfully deleted ${user.email}` })
- PageState.users = PageState.users.filter((x: any) => x.id != user.id)
- PageState.totalUsers -= 1
+ try {
+ await deleteUser({ projectRef: ref, user })
+ ui.setNotification({ category: 'success', message: `Successfully deleted ${user.email}` })
+ PageState.users = PageState.users.filter((x: any) => x.id != user.id)
+ PageState.totalUsers -= 1
+ } finally {
+ }
},
})
}
@@ -83,11 +95,14 @@ const UserDropdown = ({ user, canRemoveUser, canRemoveMFAFactors }: UserDropdown
message: `This is permanent! Are you sure you want to delete the user's MFA factors?`,
onAsyncConfirm: async () => {
if (!ref) return console.error('Project ref is required')
- await deleteUserMFAFactors({ projectRef: ref, userId: user.id })
- ui.setNotification({
- category: 'success',
- message: "Successfully deleted the user's factors",
- })
+ try {
+ await deleteUserMFAFactors({ projectRef: ref, userId: user.id })
+ ui.setNotification({
+ category: 'success',
+ message: "Successfully deleted the user's factors",
+ })
+ } finally {
+ }
},
})
}
diff --git a/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx b/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
index d5af40b525b..a874bbed664 100644
--- a/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
+++ b/studio/components/interfaces/BillingV2/Subscription/Tier/ExitSurveyModal.tsx
@@ -93,11 +93,14 @@ const ExitSurveyModal = ({ visible, onClose }: ExitSurveyModalProps) => {
return
}
- await sendExitSurvey({
- projectRef,
- reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
- message,
- })
+ try {
+ await sendExitSurvey({
+ projectRef,
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ message,
+ })
+ } finally {
+ }
ui.setNotification({
category: 'success',
diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/ExitSurveyModal.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/ExitSurveyModal.tsx
index 0154d074f04..3a812efce30 100644
--- a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/ExitSurveyModal.tsx
+++ b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/ExitSurveyModal.tsx
@@ -77,19 +77,25 @@ const ExitSurveyModal = ({ visible, subscription, onClose }: ExitSurveyModalProp
}
}
- const downgradeOrganization = async (values?: any) => {
+ const downgradeOrganization = async () => {
// Update the subscription first, followed by posting the exit survey if successful
// If compute instance is present within the existing subscription, then a restart will be triggered
if (!slug) return console.error('Slug is required')
- await updateOrgSubscription({ slug, tier: 'tier_free' })
- resetCaptcha()
+ try {
+ await updateOrgSubscription({ slug, tier: 'tier_free' })
+ resetCaptcha()
+ } finally {
+ }
- await sendExitSurvey({
- orgSlug: slug,
- reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
- message,
- })
+ try {
+ await sendExitSurvey({
+ orgSlug: slug,
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ message,
+ })
+ } finally {
+ }
ui.setNotification({
category: 'success',
diff --git a/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx b/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
index 6e3433af6a8..63f29638fe6 100644
--- a/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
+++ b/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
@@ -71,11 +71,14 @@ const DeleteProjectButton = ({ type = 'danger' }: DeleteProjectButtonProps) => {
await deleteProject({ projectRef: project.ref })
if (!isFree) {
- await sendExitSurvey({
- projectRef,
- message,
- reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
- })
+ try {
+ await sendExitSurvey({
+ projectRef,
+ message,
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ })
+ } finally {
+ }
}
ui.setNotification({ category: 'success', message: `Successfully deleted ${project.name}` })
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
index e7420496bed..0b9571b34ba 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
@@ -107,7 +107,6 @@ const FeedbackWidget: FC<Props> = ({
})
setFeedback('')
ui.setNotification({ category: 'success', message: 'Feedback sent. Thank you!' })
- } catch (error) {
} finally {
setSending(false)
}