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.
useEffect(() => {
if (!agentId) {
if (!agentId || agentsQuery.data?.status !== 200) {
setAvailableModels([]);
setModel("");
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;
const agentDefaultModel =
@ -213,7 +214,7 @@ export function AssignIssueAgentDialog({
return () => {
cancelled = true;
};
}, [agentId, agents]);
}, [agentId, agentsQuery.data]);
if (!issue) return null;