Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui): ignore stale available-teams fetch on unmount or token change

Yuneng Jiang484cc12ab6f1
diff --git a/ui/litellm-dashboard/src/components/team/AvailableTeamsPanel.tsx b/ui/litellm-dashboard/src/components/team/AvailableTeamsPanel.tsx
index 30d0f067be5..d7768e8376f 100644
--- a/ui/litellm-dashboard/src/components/team/AvailableTeamsPanel.tsx
+++ b/ui/litellm-dashboard/src/components/team/AvailableTeamsPanel.tsx
@@ -16,6 +16,8 @@ const AvailableTeamsPanel: React.FC<AvailableTeamsProps> = ({ accessToken, userI
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
+ let ignore = false;
+
const fetchAvailableTeams = async () => {
if (!accessToken || !userID) {
setIsLoading(false);
@@ -24,15 +26,23 @@ const AvailableTeamsPanel: React.FC<AvailableTeamsProps> = ({ accessToken, userI
try {
const response = await availableTeamListCall(accessToken);
- setAvailableTeams(response);
+ if (!ignore) {
+ setAvailableTeams(response);
+ }
} catch (error) {
console.error("Error fetching available teams:", error);
} finally {
- setIsLoading(false);
+ if (!ignore) {
+ setIsLoading(false);
+ }
}
};
fetchAvailableTeams();
+
+ return () => {
+ ignore = true;
+ };
}, [accessToken, userID]);
const handleJoinTeam = async (teamId: string) => {