Changed the useEffect dependency from the unstable agents array to agentsQuery.data

This commit is contained in:
null 2026-05-25 17:48:03 -05:00
parent 240313a431
commit 2d40ae0d63
1 changed files with 4 additions and 3 deletions

View File

@ -189,12 +189,13 @@ export function AssignIssueAgentDialog({
// When agent changes, fetch models from its gateway and pre-select the agent's default. // When agent changes, fetch models from its gateway and pre-select the agent's default.
useEffect(() => { useEffect(() => {
if (!agentId) { if (!agentId || agentsQuery.data?.status !== 200) {
setAvailableModels([]); setAvailableModels([]);
setModel(""); setModel("");
return; return;
} }
const selectedAgent = agents.find((a) => a.id === agentId); const items = agentsQuery.data.data.items ?? [];
const selectedAgent = items.find((a) => a.id === agentId);
if (!selectedAgent) return; if (!selectedAgent) return;
const agentDefaultModel = const agentDefaultModel =
@ -213,7 +214,7 @@ export function AssignIssueAgentDialog({
return () => { return () => {
cancelled = true; cancelled = true;
}; };
}, [agentId, agents]); }, [agentId, agentsQuery.data]);
if (!issue) return null; if (!issue) return null;