fix(frontend): onboarding re-directs (#11126)

## Changes 🏗️

We weren't awaiting the onboarding enabled check and also we were
re-directing to a wrong onboarding URL.

## Checklist 📋

### For code changes

- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Create a new user
  - [x] Re-directs well to onboarding
  - [x] Complete up to Step 5 and logout
  - [x] Login again
  - [x] You are on Step 5  

#### For configuration changes:

None
This commit is contained in:
Ubbe
2025-10-08 19:18:25 +04:00
committed by GitHub
parent e562ca37aa
commit 73603a8ce5

View File

@@ -1,14 +1,16 @@
import BackendAPI from "@/lib/autogpt-server-api";
import { redirect } from "next/navigation";
import { finishOnboarding } from "./6-congrats/actions";
import { shouldShowOnboarding } from "@/app/api/helpers";
// Force dynamic rendering to avoid static generation issues with cookies
export const dynamic = "force-dynamic";
export default async function OnboardingPage() {
const api = new BackendAPI();
const isOnboardingEnabled = await shouldShowOnboarding();
if (!api.isOnboardingEnabled()) {
if (!isOnboardingEnabled) {
redirect("/marketplace");
}
@@ -23,7 +25,7 @@ export default async function OnboardingPage() {
else if (onboarding.completedSteps.includes("AGENT_NEW_RUN"))
redirect("/onboarding/5-run");
else if (onboarding.completedSteps.includes("AGENT_CHOICE"))
redirect("/onboarding/5-agent");
redirect("/onboarding/5-run");
else if (onboarding.completedSteps.includes("INTEGRATIONS"))
redirect("/onboarding/4-agent");
else if (onboarding.completedSteps.includes("USAGE_REASON"))