diff --git a/apps/studio/components/interfaces/Organization/OrgNotFound.tsx b/apps/studio/components/interfaces/Organization/OrgNotFound.tsx
index 673c8e116c0..2da3c4f293d 100644
--- a/apps/studio/components/interfaces/Organization/OrgNotFound.tsx
+++ b/apps/studio/components/interfaces/Organization/OrgNotFound.tsx
@@ -15,17 +15,19 @@ export const OrgNotFound = ({ slug }: { slug?: string }) => {
return (
<>
-
- The selected organization does not exist or you don't have permission to access it.{' '}
- {slug ? (
- <>
- Contact the owner or administrator to create a new project in the {slug}{' '}
- organization.
- >
- ) : (
- <>Contact the owner or administrator to create a new project.>
- )}
-
+ {slug !== '_' && (
+
+ The selected organization does not exist or you don't have permission to access it.{' '}
+ {slug ? (
+ <>
+ Contact the owner or administrator to create a new project in the {slug}{' '}
+ organization.
+ >
+ ) : (
+ <>Contact the owner or administrator to create a new project.>
+ )}
+
+ )}
Select an organization to create your new project from
diff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsx
index 2ba15120023..99d23500a1b 100644
--- a/apps/studio/pages/new/[slug].tsx
+++ b/apps/studio/pages/new/[slug].tsx
@@ -146,6 +146,15 @@ const Wizard: NextPageWithLayout = () => {
''
)
+ // This is to make the database.new redirect work correctly. The database.new redirect should be set to supabase.com/dashboard/new/last-visited-org
+ if (slug === 'last-visited-org') {
+ if (lastVisitedOrganization) {
+ router.replace(`/new/${lastVisitedOrganization}`, undefined, { shallow: true })
+ } else {
+ router.replace(`/new/_`, undefined, { shallow: true })
+ }
+ }
+
const { mutate: sendEvent } = useSendEventMutation()
const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')
@@ -156,7 +165,10 @@ const Wizard: NextPageWithLayout = () => {
{ enabled: isFreePlan }
)
- const { data: approvedOAuthApps } = useAuthorizedAppsQuery({ slug }, { enabled: !isFreePlan })
+ const { data: approvedOAuthApps } = useAuthorizedAppsQuery(
+ { slug },
+ { enabled: !isFreePlan && slug !== '_' }
+ )
const hasOAuthApps = approvedOAuthApps && approvedOAuthApps.length > 0
@@ -623,7 +635,9 @@ const Wizard: NextPageWithLayout = () => {
/>
)}
- {!isAdmin && !orgNotFound && }
+ {isOrganizationsSuccess && !isAdmin && !orgNotFound && (
+
+ )}
{orgNotFound && }