Skip to content

Commit 5527e04

Browse files
committed
feat(settings): redirect to integrations when vercelOnboarding
Redirect /settings to /settings/general by default, but detect the vercelOnboarding query parameter and redirect to /settings/integrations when present. Factor org/project/env slug objects and preserve original search params on redirect. This ensures users entering the settings route during Vercel onboarding are taken directly to the integrations page.
1 parent 3cecb9d commit 5527e04

File tree

1 file changed

+11
-9
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings

1 file changed

+11
-9
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as Property from "~/components/primitives/PropertyTable";
77
import { AdminDebugTooltip } from "~/components/admin/debugTooltip";
88
import { useProject } from "~/hooks/useProject";
99
import { requireUserId } from "~/services/session.server";
10-
import { EnvironmentParamSchema, v3ProjectSettingsGeneralPath } from "~/utils/pathBuilder";
10+
import { EnvironmentParamSchema, v3ProjectSettingsGeneralPath, v3ProjectSettingsIntegrationsPath } from "~/utils/pathBuilder";
1111

1212
export const meta: MetaFunction = () => {
1313
return [
@@ -21,16 +21,18 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
2121
await requireUserId(request);
2222
const { organizationSlug, projectParam, envParam } = EnvironmentParamSchema.parse(params);
2323

24-
// Redirect /settings to /settings/general
24+
// Redirect /settings to /settings/general (or /settings/integrations for Vercel onboarding)
2525
const url = new URL(request.url);
2626
if (url.pathname.endsWith("/settings") || url.pathname.endsWith("/settings/")) {
27-
return redirect(
28-
v3ProjectSettingsGeneralPath(
29-
{ slug: organizationSlug },
30-
{ slug: projectParam },
31-
{ slug: envParam }
32-
)
33-
);
27+
const org = { slug: organizationSlug };
28+
const project = { slug: projectParam };
29+
const env = { slug: envParam };
30+
31+
const basePath = url.searchParams.has("vercelOnboarding")
32+
? v3ProjectSettingsIntegrationsPath(org, project, env)
33+
: v3ProjectSettingsGeneralPath(org, project, env);
34+
35+
return redirect(`${basePath}${url.search}`);
3436
}
3537

3638
return null;

0 commit comments

Comments
 (0)