mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix: prevent phantom "Unnamed Server" view after deleting MCP server
- Reset selectedServerId and editServer state when deleting the currently viewed MCP server to return user to the server list - Avoids the detail view remaining mounted with an empty stub server after deletion
This commit is contained in:
parent
b2e25b3915
commit
5d57c6bfa3
1 changed files with 8 additions and 0 deletions
|
|
@ -267,6 +267,14 @@ const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID })
|
|||
setIsDeletingServer(true);
|
||||
await deleteMCPServer(accessToken, serverIdToDelete);
|
||||
NotificationsManager.success("Deleted MCP Server successfully");
|
||||
// If the user is currently viewing the detail page of the server they
|
||||
// just deleted, return them to the All Servers list. Otherwise the
|
||||
// detail view would stay mounted, fall back to an empty stub server,
|
||||
// and show a phantom "Unnamed Server" page.
|
||||
if (selectedServerId === serverIdToDelete) {
|
||||
setEditServer(false);
|
||||
setSelectedServerId(null);
|
||||
}
|
||||
refetch();
|
||||
} catch (error) {
|
||||
console.error("Error deleting the mcp server:", error);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue