From 9a8819b8ccc7d354d3c8ffd6ecdbf2cdc6daf1aa Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Tue, 5 May 2026 15:18:19 -0700 Subject: [PATCH] fix(ui): drop duplicate v2/team/list fetch racing OldTeams' paginated fetch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /?page=teams route had two parallel mount-effects writing to the same `teams` state: page.tsx fired v2TeamListCall(page=1, page_size=100) and OldTeams.tsx fired v2TeamListCall(page=1, page_size=10) via fetchTeamsV2(). Whichever response landed last won, so the table sometimes rendered all teams and sometimes only the first 10 — manifesting as "loads 10, refresh loads 10 more" depending on which fetch resolved second. OldTeams already owns its own paginated team-fetching state (currentPage, pageSize, totalTeams) and is the only consumer of `teams` on this route. The page-level fetch was redundant; removing it eliminates the race and lets pagination/sort/filter behave consistently. The race was introduced in 883611aa918 (2026-03-19, "Modernize teams table with AntD, server-side pagination, and v2 API"), which switched the long-existing page-level fetch from v1 to v2(size=100). Before that, both writers happened to return the same dataset so the duplicate was invisible. --- ui/litellm-dashboard/src/app/page.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ui/litellm-dashboard/src/app/page.tsx b/ui/litellm-dashboard/src/app/page.tsx index 06bf3b68d05..ea8c505b540 100644 --- a/ui/litellm-dashboard/src/app/page.tsx +++ b/ui/litellm-dashboard/src/app/page.tsx @@ -8,7 +8,6 @@ import AgentsPanel from "@/components/agents"; import BudgetPanel from "@/components/budgets/budget_panel"; import CacheDashboard from "@/components/cache_dashboard"; import ClaudeCodePluginsPanel from "@/components/claude_code_plugins"; -import { teamListCall as v2TeamListCall } from "@/app/(dashboard)/hooks/teams/useTeams"; import LoadingScreen from "@/components/common_components/LoadingScreen"; import { CostTrackingSettings } from "@/components/CostTrackingSettings"; import GeneralSettings from "@/components/general_settings"; @@ -353,11 +352,6 @@ function CreateKeyPageContent() { if (accessToken && userID && userRole) { fetchUserModels(userID, userRole, accessToken, setUserModels); } - if (accessToken && userID && userRole) { - v2TeamListCall(accessToken, 1, 100, { - userID: userRole !== "Admin" && userRole !== "Admin Viewer" ? userID : null, - }).then((response) => setTeams(response.teams ?? [])).catch(console.error); - } if (accessToken) { fetchOrganizations(accessToken, setOrganizations); }