From 697eaad2d70280de8a3c94ed1e7426680cb9fad8 Mon Sep 17 00:00:00 2001 From: mawkone Date: Mon, 8 Jun 2026 13:31:11 -0700 Subject: [PATCH] fix(agency): permanently resolve double-sidebar race condition by cleanly redirecting agency workspaces from /projects to a dedicated /agency route --- vibn-frontend/app/[workspace]/projects/page.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vibn-frontend/app/[workspace]/projects/page.tsx b/vibn-frontend/app/[workspace]/projects/page.tsx index 56841b7f..d524a26e 100644 --- a/vibn-frontend/app/[workspace]/projects/page.tsx +++ b/vibn-frontend/app/[workspace]/projects/page.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { useSession } from "next-auth/react"; -import { useParams } from "next/navigation"; +import { useParams, useRouter } from "next/navigation"; import Link from "next/link"; import { ProjectCreationModal } from "@/components/project-creation-modal"; import { @@ -17,7 +17,6 @@ import { } from "@/components/ui/alert-dialog"; import { Loader2, Trash2 } from "lucide-react"; import { toast } from "sonner"; -import AgencyDashboard from "../agency/page"; interface ProjectWithStats { id: string; @@ -109,11 +108,11 @@ function StatusTag({ status }: { status?: string }) { export default function ProjectsPage() { const params = useParams(); + const router = useRouter(); const workspace = params.workspace as string; const { data: session, status } = useSession(); const [projects, setProjects] = useState([]); - const [isAgency, setIsAgency] = useState(null); const [loading, setLoading] = useState(true); const [loadError, setLoadError] = useState(null); const [showNew, setShowNew] = useState(false); @@ -134,10 +133,9 @@ export default function ProjectsPage() { }); if (wsRes.ok) { const wsData = await wsRes.json(); - setIsAgency(wsData.isAgency); if (wsData.isAgency) { - setLoading(false); - return; // Stop fetching projects if it's an agency, let AgencyDashboard handle its own data + router.replace(`/${workspace}/agency`); + return; } } @@ -209,10 +207,6 @@ export default function ProjectsPage() { return `${projects.length} total · ${parts.join(" · ")}`; }; - if (isAgency === true) { - return ; - } - return (