From e60e7c96e7ce47fba4129c67c62353e09da4de8f Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Fri, 1 May 2026 17:34:20 +0100 Subject: [PATCH] fix(settings): use organization_id (not slug) in /org/:orgSlug/settings URL The backend /organizations/{org_id}/members endpoint queries memberships by organization_id (_id hex string), but the sidebar was building the URL from organization_slug (e.g. "3m-test"), causing 403 on every Settings page load ("Failed to load members."). - Sidebar: derive currentOrgId from organization_id; option values = org ID - OrgSettingsLayout: alias orgSlug param as orgId for clarity Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/Layout/Sidebar.tsx | 20 ++++++++++--------- frontend/src/routes/org/OrgSettingsLayout.tsx | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/Layout/Sidebar.tsx b/frontend/src/components/Layout/Sidebar.tsx index 4570dda..de8ecd7 100644 --- a/frontend/src/components/Layout/Sidebar.tsx +++ b/frontend/src/components/Layout/Sidebar.tsx @@ -42,10 +42,12 @@ export function Sidebar({ onMobileClose }: SidebarProps) { const failuresBadge = isAdminOrProduction ? (failuresData?.total || 0) : 0; const briefsBadge = allBriefs.filter(b => b.status === 'submitted').length; - // Determine current org from route params or first membership - const currentOrgSlug = + // Determine current org ID from route params or first membership. + // The route param :orgSlug actually carries the organization _id (hex string), + // not the human-readable slug — the backend queries memberships by organization_id. + const currentOrgId = params.orgSlug || - (memberships.length === 1 ? memberships[0].organization_slug : null); + (memberships.length === 1 ? memberships[0].organization_id : null); const sidebarItems: SidebarItem[] = [ { @@ -160,15 +162,15 @@ export function Sidebar({ onMobileClose }: SidebarProps) { ) : (