Skip to content

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

fix: suppress misleading toast when navigating away from a deleted project (#44032)

Charis634bd2760ff7
diff --git a/apps/studio/components/interfaces/App/RouteValidationWrapper.tsx b/apps/studio/components/interfaces/App/RouteValidationWrapper.tsx
index 617d3cad4ed..6d8b2a124a2 100644
--- a/apps/studio/components/interfaces/App/RouteValidationWrapper.tsx
+++ b/apps/studio/components/interfaces/App/RouteValidationWrapper.tsx
@@ -52,7 +52,7 @@ export const RouteValidationWrapper = ({ children }: PropsWithChildren<{}>) => {
return excemptUrls.includes(router?.pathname)
}
- const { isError: isErrorProject } = useProjectDetailQuery({ ref })
+ const { isError: isErrorProject, error: projectError } = useProjectDetailQuery({ ref })
const { data: organizations, isSuccess: orgsInitialized } = useOrganizationsQuery({
enabled: isLoggedIn,
@@ -82,7 +82,10 @@ export const RouteValidationWrapper = ({ children }: PropsWithChildren<{}>) => {
// A successful request to project details will validate access to both project and branches
if (!!ref && isErrorProject) {
- toast.error('You do not have access to this project')
+ // 404 means the project no longer exists (e.g. was deleted), not an access error
+ if (projectError?.code !== 404) {
+ toast.error('You do not have access to this project')
+ }
router.push(DEFAULT_HOME)
return
}