fix: fix mcp server status is not right (#31826)

Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
This commit is contained in:
wangxiaolei 2026-02-04 16:55:12 +08:00 committed by GitHub
parent 0d74ac634b
commit ec7ccd800c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 8 deletions

View File

@ -103,15 +103,22 @@ const MCPDetailContent: FC<Props> = ({
return
if (!detail)
return
const res = await authorizeMcp({
provider_id: detail.id,
})
if (res.result === 'success')
handleUpdateTools()
try {
const res = await authorizeMcp({
provider_id: detail.id,
})
if (res.result === 'success')
handleUpdateTools()
else if (res.authorization_url)
openOAuthPopup(res.authorization_url, handleOAuthCallback)
}, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback])
else if (res.authorization_url)
openOAuthPopup(res.authorization_url, handleOAuthCallback)
}
catch {
// On authorization error, refresh the parent component state
// to update the connection status indicator
onUpdate()
}
}, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback, onUpdate])
const handleUpdate = useCallback(async (data: any) => {
if (!detail)