Skip to content

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

fix(studio): only redirect after project deletion if still on project page (#44633)

Ivan Vasilovf55797fcdad3
diff --git a/apps/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal.tsx b/apps/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal.tsx
index b4b9f51271e..4e96189765a 100644
--- a/apps/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal.tsx
+++ b/apps/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal.tsx
@@ -83,8 +83,14 @@ export const DeleteProjectModal = ({
toast.success(`Successfully deleted ${project?.name}`)
- if (lastVisitedOrganization) router.push(`/org/${lastVisitedOrganization}`)
- else router.push('/organizations')
+ // Only redirect if still viewing the deleted project
+ if (router.asPath.startsWith(`/project/${projectRef}`)) {
+ if (lastVisitedOrganization) {
+ router.push(`/org/${lastVisitedOrganization}`)
+ } else {
+ router.push('/organizations')
+ }
+ }
},
})
const { mutateAsync: sendExitSurvey, isPending: isSending } = useSendDowngradeFeedbackMutation()