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]

Prevent navigation reset after team member operations (#12424)

tanjirodf2a2fac4336
diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx
index 05f179fa567..7334cfa1f1e 100644
--- a/ui/litellm-dashboard/src/components/team/team_info.tsx
+++ b/ui/litellm-dashboard/src/components/team/team_info.tsx
@@ -116,7 +116,8 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
is_proxy_admin,
userModels,
editTeam,
- premiumUser = false
+ premiumUser = false,
+ onUpdate
}) => {
const [teamData, setTeamData] = useState<TeamData | null>(null);
const [loading, setLoading] = useState(true);
@@ -163,7 +164,13 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
message.success("Team member added successfully");
setIsAddMemberModalVisible(false);
form.resetFields();
- fetchTeamInfo();
+
+ // Fetch updated team info
+ const updatedTeamData = await teamInfoCall(accessToken, teamId);
+ setTeamData(updatedTeamData);
+
+ // Notify parent component of the update
+ onUpdate(updatedTeamData);
} catch (error: any) {
let errMsg = "Failed to add team member";
@@ -198,7 +205,13 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
message.success("Team member updated successfully");
setIsEditMemberModalVisible(false);
- fetchTeamInfo();
+
+ // Fetch updated team info
+ const updatedTeamData = await teamInfoCall(accessToken, teamId);
+ setTeamData(updatedTeamData);
+
+ // Notify parent component of the update
+ onUpdate(updatedTeamData);
} catch (error: any) {
let errMsg = "Failed to update team member";
if (error?.raw?.detail?.includes("Assigning team admins is a premium feature")) {
@@ -222,10 +235,16 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
return;
}
- const response = await teamMemberDeleteCall(accessToken, teamId, member);
+ await teamMemberDeleteCall(accessToken, teamId, member);
message.success("Team member removed successfully");
- fetchTeamInfo();
+
+ // Fetch updated team info
+ const updatedTeamData = await teamInfoCall(accessToken, teamId);
+ setTeamData(updatedTeamData);
+
+ // Notify parent component of the update
+ onUpdate(updatedTeamData);
} catch (error) {
message.error("Failed to remove team member");
console.error("Error removing team member:", error);