feat: serve welcome at root and dashboard at /dashboard#4307
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR moves the public welcome/marketing page to serve from
Confidence Score: 4/5The routing refactor is structurally sound and well-tested, but the auth redirect in WelcomeApp strips query params, breaking checkout return handling for any payment sessions active at the moment of deployment. The URL migration is thorough and consistent across all 43 files — constants centralised, SEO meta updated, rewrites/redirects/headers aligned, and test assertions rewritten. The one gap is in WelcomeApp.tsx: window.location.replace(DASHBOARD_PATH) discards the current URL query string. Any checkout session initiated before deployment whose payment completes after and returns to /?wm_checkout=success would get redirected to bare /dashboard, dropping the param that triggers the post-checkout success state. The window is bounded by in-flight sessions at deploy time, and the developer's monitoring plan covers it, but the fix is a one-liner. pro-test/src/WelcomeApp.tsx — the auth redirect needs to forward window.location.search to the target URL. Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User / Browser
participant V as Vercel Edge
participant W as /pro/welcome.html
participant S as /index.html (SPA)
participant C as WelcomeApp auth check
Note over U,S: Anonymous visitor
U->>V: GET /
V->>W: rewrite → /pro/welcome.html
W-->>U: 200 Marketing page
Note over U,S: Legacy welcome link
U->>V: GET /welcome
V-->>U: 301 → /
Note over U,S: Signed-in visitor arriving at /
U->>V: GET /
V->>W: rewrite → /pro/welcome.html
W-->>U: 200 Marketing page (brief)
U->>C: mayHaveClerkSession() → true
C->>C: ensureClerk() → clerk.user truthy
C-->>U: window.location.replace('/dashboard')
U->>V: GET /dashboard
V->>S: rewrite → /index.html
S-->>U: 200 SPA Dashboard
Note over U,S: Post-checkout return (new sessions)
U->>V: "GET /dashboard?wm_checkout=success"
V->>S: rewrite → /index.html
S-->>U: 200 SPA + success state shown
Reviews (1): Last reviewed commit: "feat: serve welcome at root and dashboar..." | Re-trigger Greptile |
| } catch { | ||
| // Storage can be unavailable in private contexts; fall through to anonymous. | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| export default function WelcomeApp() { | ||
| useEffect(() => { | ||
| if (!mayHaveClerkSession()) return; |
There was a problem hiding this comment.
Auth redirect strips query params from the current URL
window.location.replace(DASHBOARD_PATH) unconditionally navigates to /dashboard without preserving any query parameters. Any checkout session that was started before this PR deploys — and returns to the old returnUrl of /?wm_checkout=success — would land on the welcome page, trigger this redirect, and arrive at /dashboard with the wm_checkout parameter gone. The SPA's handleCheckoutReturn logic never fires, so the post-checkout success state never shows. The subscription is still activated server-side, but the user gets no UI confirmation. The same loss applies to ?checkoutProduct=, ?ref=, or ?lang= params embedded in external links pointing at /.
A minimal fix is to forward the current window.location.search to the redirect target:
const target = window.location.search
? `${DASHBOARD_PATH}${window.location.search}`
: DASHBOARD_PATH;
window.location.replace(target);
| { "source": "/.well-known/oauth-protected-resource", "destination": "/api/oauth-protected-resource" }, | ||
| { "source": "/embed", "destination": "/embed.html" }, | ||
| { "source": "/dashboard", "destination": "/index.html" }, | ||
| { "source": "/((?!api|mcp|oauth|assets|blog|docs|embed|embed\\.html|favico|map-styles|data|textures|pro|welcome|sw\\.js|workbox-[a-f0-9]+\\.js|manifest\\.webmanifest|offline\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|llms-full\\.txt|openapi\\.yaml|\\.well-known|wm-widget-sandbox\\.html|mcp-grant\\.html|mcp-grant).*)", "destination": "/index.html" } |
There was a problem hiding this comment.
Stale
welcome exclusion in SPA catch-all rewrite
|welcome| is still in the negative lookahead of the catch-all rewrite source. Since /welcome is now handled by a redirect rule (which Vercel evaluates before rewrites), the exclusion is dead. It currently causes no routing bug, but it implies that welcome paths receive special rewrite treatment — which is no longer true — and could confuse future contributors or silently affect paths like /welcome-guide if they are ever added.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
caa9e23 to
8e6d85d
Compare
Summary
/and permanently redirect legacy/welcometo root./dashboard, including canonicals, sitemap, Link headers, checkout returns, and dashboard CTAs./dashboardafter lazy Clerk verification, while keeping anonymous visitors on the landing page without eagerly loading auth.Testing
npm run lintinpro-testnpm run buildinpro-testnode --test tests/deploy-config.test.mjsTMPDIR=/tmp node --import tsx --test tests/checkout-return-discriminant.test.mts tests/deploy-config.test.mjsnpm run typechecknpm run typecheck:apigit pushpre-push hook passed, including typechecks, server handler tests, changed tests, edge function tests, pro-test bundle freshness, and version sync.Post-Deploy Monitoring & Validation
/returns the welcome HTML,/dashboardreturns the dashboard shell,/welcomereturns a permanent redirect to/, and checkout success returns land on/dashboard?wm_checkout=successbefore client cleanup./,/dashboard,/welcome,/pro,/pro/welcome.html, and/index.html.WelcomeApp,ensureClerk,wm_checkout,DASHBOARD_CHECKOUT_SUCCESS_URL, orembed=pro-preview./ishttps://www.worldmonitor.app/, canonical on/dashboardishttps://www.worldmonitor.app/dashboard, and sitemap contains/dashboardbut not/welcome./or/dashboard, logged-in users stuck on root, checkout users failing to reach the dashboard success state, or CSP violations blocking dashboard scripts. Mitigation: revert this PR or restore prior Vercel rewrites/canonicals while investigating.