Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): only auto-redirect past workspace list on post-login flow

Generf971bf2c9ef3
diff --git a/src/web/src/app/(app)/workspaces/page.tsx b/src/web/src/app/(app)/workspaces/page.tsx
index 211c51bb7..245db4962 100644
--- a/src/web/src/app/(app)/workspaces/page.tsx
+++ b/src/web/src/app/(app)/workspaces/page.tsx
@@ -18,7 +18,11 @@ function randomSuffix(): string {
return Math.random().toString(36).slice(2, 8)
}
-export default async function WorkspacesPage() {
+export default async function WorkspacesPage({
+ searchParams,
+}: {
+ searchParams: Promise<Record<string, string | undefined>>
+}) {
const session = await requireSession()
const { env } = await getCloudflareContext({ async: true })
const db = createDb((env as Env).DB)
@@ -52,8 +56,9 @@ export default async function WorkspacesPage() {
workspaces = await queries.workspace.listWorkspaces(db, session.user.id)
}
- // Single workspace — skip the list page
- if (workspaces.length === 1) {
+ // Auto-redirect to single workspace only on post-login flow
+ const params = await searchParams
+ if (workspaces.length === 1 && params.auto !== undefined) {
redirect(`/w/${workspaces[0].slug}/home`)
}
diff --git a/src/web/src/app/(auth)/sign-in/page.tsx b/src/web/src/app/(auth)/sign-in/page.tsx
index 1e8a2935c..9de81f56f 100644
--- a/src/web/src/app/(auth)/sign-in/page.tsx
+++ b/src/web/src/app/(auth)/sign-in/page.tsx
@@ -64,7 +64,7 @@ function OTPSignIn() {
setError(error.message ?? "Invalid code")
setCode("")
} else {
- window.location.href = "/workspaces"
+ window.location.href = "/workspaces?auto"
return
}
} catch {
@@ -151,7 +151,7 @@ function OTPSignIn() {
variant="outline"
type="button"
onClick={() =>
- signIn.social({ provider: "github", callbackURL: "/workspaces" })
+ signIn.social({ provider: "github", callbackURL: "/workspaces?auto" })
}
>
<SiGithub className="size-4" />
@@ -161,7 +161,7 @@ function OTPSignIn() {
variant="outline"
type="button"
onClick={() =>
- signIn.social({ provider: "google", callbackURL: "/workspaces" })
+ signIn.social({ provider: "google", callbackURL: "/workspaces?auto" })
}
>
<SiGoogle className="size-4" />
@@ -189,7 +189,7 @@ function PasswordSignIn() {
if (error) {
setError(error.message ?? "")
} else {
- window.location.href = "/workspaces"
+ window.location.href = "/workspaces?auto"
return
}
setLoading(false)
@@ -239,7 +239,7 @@ function PasswordSignIn() {
variant="outline"
type="button"
onClick={() =>
- signIn.social({ provider: "github", callbackURL: "/workspaces" })
+ signIn.social({ provider: "github", callbackURL: "/workspaces?auto" })
}
>
<SiGithub className="size-4" />
@@ -249,7 +249,7 @@ function PasswordSignIn() {
variant="outline"
type="button"
onClick={() =>
- signIn.social({ provider: "google", callbackURL: "/workspaces" })
+ signIn.social({ provider: "google", callbackURL: "/workspaces?auto" })
}
>
<SiGoogle className="size-4" />
diff --git a/src/web/src/app/(auth)/sign-up/page.tsx b/src/web/src/app/(auth)/sign-up/page.tsx
index ead2851fa..3ed9b8b9e 100644
--- a/src/web/src/app/(auth)/sign-up/page.tsx
+++ b/src/web/src/app/(auth)/sign-up/page.tsx
@@ -33,7 +33,7 @@ function SignUpForm() {
if (error) {
setError(error.message ?? "")
} else {
- window.location.href = "/workspaces"
+ window.location.href = "/workspaces?auto"
return
}
setLoading(false)
diff --git a/src/web/src/app/page.tsx b/src/web/src/app/page.tsx
index 8ed477a2b..d3ba5be7e 100644
--- a/src/web/src/app/page.tsx
+++ b/src/web/src/app/page.tsx
@@ -3,6 +3,6 @@ import { redirect } from "next/navigation";
export default async function Page() {
const session = await getSession();
- if (session) redirect("/workspaces");
+ if (session) redirect("/workspaces?auto");
redirect("/sign-in");
}