From fdf33e72c4d528fcfb3f7baa1bc3fda828eddc09 Mon Sep 17 00:00:00 2001
From: Danny White <3104761+dnywh@users.noreply.github.com>
Date: Mon, 24 Aug 2026 17:32:56 +1000
Subject: [PATCH] fix(studio): clean up onboarding returnTo paths (#49283)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## What kind of change does this PR introduce?
Bug fix. Follow-up to #41041 and DEPR-318.
## What is the current behavior?
Marketing "Start your project" links go to `/dashboard`, which redirects
unauthenticated users to `/org` and sets `returnTo=/org`. That value
survives when they switch from sign-in to sign-up, so email verification
still lands on the org list instead of org creation.
## What is the new behavior?
- Sign-in's **Sign up** link rewrites `returnTo=/org` (and
`/organizations`) to `/new`
- Docs mobile menu, www homepage/product CTAs, and solution page CTAs
link to `/dashboard/sign-up` for guests
- Signed-in visitors get the dashboard URL instead, so they never hit
the sign-up form
- Shared `DASHBOARD_SIGN_UP_URL` / `getDashboardCtaHref` helpers for www
Stacked on #41041.
## To test
Stacked on #41041. The studio preview below includes both PRs. www and
docs have their own previews.
### Studio: sign-in → sign-up rewrite
Using the [studio-staging
preview](https://studio-staging-git-dnywh-fixonboarding-return-to-supabase.vercel.app/)
from Vercel checks:
1. Open the preview while logged out. It should land on
`/dashboard/sign-in?returnTo=%2Forg`
2. Click **Sign up**. Expect the URL to include `returnTo=%2Fnew`
### Optional: www CTAs
Using the [www
preview](https://zone-www-dot-com-git-dnywh-fixonboarding-return-to-supabase.vercel.app/):
3. Logged out: homepage, product, or solutions **Start your project**
should go to `/dashboard/sign-up`
4. Logged in: the same CTAs should go to `/dashboard` (not sign-up)
(thought this will be hard if not impossible to test on staging)
### Optional: docs CTAs
Using the [docs
preview](https://docs-git-dnywh-fixonboarding-return-to-supabase.vercel.app/):
5. On mobile nav while logged out, click **Start your project**. Expect
`/dashboard/sign-up`
### Compare on supabase.green
Optional. Just to show what happens currently on `master`:
6. Open **supabase.green** while logged out, then click **Sign up** from
`/dashboard/sign-in?returnTo=%2Forg`. `returnTo` should stay as `/org`
## Summary by CodeRabbit
* **New Features**
* Start-project and sign-up links now direct visitors to registration
while signed-in users continue to reach the dashboard.
* Homepage, product, solution, and mobile navigation CTAs now provide
consistent authentication-aware destinations.
* Sign-up links preserve return destinations and existing navigation
parameters.
* **Bug Fixes**
* Corrected mobile navigation and marketing CTA links that previously
sent visitors to the dashboard root instead of the appropriate sign-up
flow.
---
.../NavigationMenu/GlobalMobileMenu.tsx | 4 +-
apps/studio/pages/sign-in.tsx | 6 +-
.../www/app/(home)/_components/CTASection.tsx | 6 +-
apps/www/app/(home)/_components/Hero.tsx | 5 +-
.../app/(products)/auth/_components/Hero.tsx | 6 +-
.../(products)/database/_components/Hero.tsx | 6 +-
.../edge-functions/_components/CTASection.tsx | 6 +-
.../edge-functions/_components/Hero.tsx | 5 +-
.../(products)/realtime/_components/Hero.tsx | 6 +-
.../(products)/storage/_components/Hero.tsx | 6 +-
apps/www/components/CTABanner/index.tsx | 8 +-
apps/www/components/CTASection.tsx | 6 +-
.../www/components/Sections/ProductHeader.tsx | 6 +-
.../components/Sections/ProductHeader2.tsx | 149 ++++++++++--------
apps/www/components/Sections/ProductsCta2.tsx | 8 +-
.../www/components/StartYourProjectButton.tsx | 34 ++++
apps/www/data/solutions/agencies.tsx | 3 +-
apps/www/data/solutions/agents.tsx | 3 +-
apps/www/data/solutions/ai-builders.tsx | 3 +-
apps/www/data/solutions/b2b-saas.tsx | 3 +-
apps/www/data/solutions/beginners.tsx | 3 +-
apps/www/data/solutions/developers.tsx | 3 +-
apps/www/data/solutions/finserv.tsx | 3 +-
apps/www/data/solutions/hackathon.tsx | 3 +-
apps/www/data/solutions/healthcare.tsx | 3 +-
apps/www/data/solutions/hosted-postgres.tsx | 3 +-
apps/www/data/solutions/innovation-teams.tsx | 5 +-
apps/www/data/solutions/no-code.tsx | 3 +-
.../data/solutions/postgres-developers.tsx | 3 +-
apps/www/data/solutions/startups.tsx | 3 +-
apps/www/data/solutions/vibe-coders.tsx | 3 +-
apps/www/lib/dashboard-links.ts | 16 ++
32 files changed, 215 insertions(+), 115 deletions(-)
create mode 100644 apps/www/components/StartYourProjectButton.tsx
create mode 100644 apps/www/lib/dashboard-links.ts
diff --git a/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx
index 619222551c2..f0bdd88d1a0 100644
--- a/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx
@@ -168,7 +168,9 @@ const GlobalMobileMenu = ({ open, setOpen }: Props) => {
Sign in
>
)}
diff --git a/apps/studio/pages/sign-in.tsx b/apps/studio/pages/sign-in.tsx
index 9cf0b1c6ea5..c000ad453bd 100644
--- a/apps/studio/pages/sign-in.tsx
+++ b/apps/studio/pages/sign-in.tsx
@@ -16,6 +16,7 @@ import { useInboundBranding } from '@/hooks/misc/useInboundBranding'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
import { IS_PLATFORM } from '@/lib/constants'
import type { ExternalIdentityProviderConfig } from '@/lib/external-identity-providers'
+import { getSignUpReturnTo } from '@/lib/gotrue'
import type { NextPageWithLayout } from '@/types'
const SignInPage: NextPageWithLayout = () => {
@@ -131,7 +132,10 @@ const SignInPage: NextPageWithLayout = () => {
Don’t have an account?{' '}
Sign up
diff --git a/apps/www/app/(home)/_components/CTASection.tsx b/apps/www/app/(home)/_components/CTASection.tsx
index 346b93b89f2..2c8baf2412d 100644
--- a/apps/www/app/(home)/_components/CTASection.tsx
+++ b/apps/www/app/(home)/_components/CTASection.tsx
@@ -1,10 +1,14 @@
'use client'
import { useSendTelemetryEvent } from '~/lib/telemetry'
+import { useIsLoggedIn } from 'common'
import Link from 'next/link'
import { Button } from 'ui'
+import { getDashboardCtaHref } from '@/lib/dashboard-links'
+
export function CTASection() {
+ const isLoggedIn = useIsLoggedIn()
const sendTelemetryEvent = useSendTelemetryEvent()
return (
@@ -17,7 +21,7 @@ export function CTASection() {