From a3f958d8d5ee7e5803f034c1b801476e264c69ee Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 28 May 2026 03:39:37 +0000 Subject: [PATCH] fix(a2a/ui): include savedAgentCard in handleDiscover deps The previous deps list omitted savedAgentCard, so handleDiscover (and the resetSelections it calls) kept the closure's saved-card value even after the parent refetched the agent. Clicking 'Re-discover' would then pre-select skills against stale data. Adding savedAgentCard to the deps array forces the callback to refresh whenever the saved card changes. Co-authored-by: Yassin Kortam --- .../src/components/agents/agent_card_discovery.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx b/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx index a5ca5f4d562..7395c2feb91 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx +++ b/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx @@ -176,8 +176,18 @@ const AgentCardDiscovery: React.FC = ({ // ``discoveryMode`` / ``discoveryParamsKey`` are primitive proxies for // ``discoveryRequest`` content; the actual object is read via the ref // above so identity churn from the parent doesn't recreate this callback. + // ``savedAgentCard`` is captured indirectly via ``resetSelections``: if + // the parent refetches the agent and hands us a new saved card, we need + // a fresh callback so "Re-discover" pre-selects against the latest data. // eslint-disable-next-line react-hooks/exhaustive-deps - }, [accessToken, effectiveUrl, isParentDriven, discoveryMode, discoveryParamsKey]); + }, [ + accessToken, + effectiveUrl, + isParentDriven, + discoveryMode, + discoveryParamsKey, + savedAgentCard, + ]); // Auto-discover when the URL (or parent plan) becomes available. useEffect(() => {