Skip to content

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

fix: isInvalidSlug wrong logic (#18744)

Alaister Young00662a61fe00
diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx
index 59fb7988061..cdc9e1e84ea 100644
--- a/studio/pages/new/[slug].tsx
+++ b/studio/pages/new/[slug].tsx
@@ -83,7 +83,7 @@ const Wizard: NextPageWithLayout = () => {
)
const isAdmin = useCheckPermissions(PermissionAction.CREATE, 'projects')
- const isInvalidSlug = currentOrg !== undefined
+ const isInvalidSlug = isOrganizationsSuccess && currentOrg === undefined
const isEmptyOrganizations = (organizations?.length ?? 0) <= 0 && isOrganizationsSuccess
const hasMembersExceedingFreeTierLimit = (membersExceededLimit || []).length > 0
@@ -116,12 +116,12 @@ const Wizard: NextPageWithLayout = () => {
useEffect(() => {
/*
* Redirect to first org if the slug doesn't match an org slug
- * this is mainly to capture the /project/new url, which is redirected from database.new
+ * this is mainly to capture the /new/new-project url, which is redirected from database.new
*/
if (isInvalidSlug && (organizations?.length ?? 0) > 0) {
router.push(`/new/${organizations?.[0].slug}`)
}
- }, [isInvalidSlug, organizations, router])
+ }, [isInvalidSlug, organizations])
useEffect(() => {
// User added a new payment method