mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(ui/mcp): refresh parent on OAuth token persist failure during server edit
The server config is already saved by updateMCPServer when the subsequent per-user token persist throws, so returning early without onSuccess(updated) left the edit form open and the parent list stale despite a committed change. Call onSuccess(updated) before returning so the UI matches DB state; the warning toast still replaces the success toast.
This commit is contained in:
parent
465ab30cf2
commit
21ea4f90f3
2 changed files with 3 additions and 2 deletions
|
|
@ -846,7 +846,7 @@ describe("MCPServerEdit (OAuth token persistence on save)", () => {
|
|||
expect(mockSetToken).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not show success when OBO token persistence fails after update", async () => {
|
||||
it("warns but still refreshes the parent via onSuccess when OBO token persistence fails after update", async () => {
|
||||
mockOauth.tokenResponse = {
|
||||
access_token: "obo-tok",
|
||||
refresh_token: "obo-refresh",
|
||||
|
|
@ -879,7 +879,7 @@ describe("MCPServerEdit (OAuth token persistence on save)", () => {
|
|||
"MCP Server updated, but failed to persist OAuth token: write failed",
|
||||
);
|
||||
expect(NotificationsManager.success).not.toHaveBeenCalledWith("MCP Server updated successfully");
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
expect(onSuccess).toHaveBeenCalledWith(expect.objectContaining({ server_id: interactiveOAuthServer.server_id }));
|
||||
});
|
||||
|
||||
it("persists the passthrough token to sessionStorage on save after authorize", async () => {
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({
|
|||
NotificationsManager.fromBackend(
|
||||
"MCP Server updated, but failed to persist OAuth token" + (message ? `: ${message}` : ""),
|
||||
);
|
||||
onSuccess(updated);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue