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 <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-28 03:39:37 +00:00
parent a65357f9bb
commit a3f958d8d5
No known key found for this signature in database

View file

@ -176,8 +176,18 @@ const AgentCardDiscovery: React.FC<AgentCardDiscoveryProps> = ({
// ``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(() => {