Changed the useEffect dependency from the unstable agents array to agentsQuery.data
This commit is contained in:
parent
240313a431
commit
2d40ae0d63
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue