diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx index 67ab1964d..b4ec0fd5c 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx @@ -13,7 +13,7 @@ // Its state belongs to one agent: callers key it by agent name, so switching // agents remounts it instead of showing the previous agent's settings. import type { ComponentChildren } from "preact"; -import { useEffect, useRef, useState } from "preact/hooks"; +import { useEffect, useMemo, useRef, useState } from "preact/hooks"; import { ApiErrorPanel } from "@hive/shared/api-error-panel.js"; import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js"; import { ActionRow } from "../../ui/action-row/ActionRow.js"; @@ -329,7 +329,10 @@ export function AgentInference({ agent }: { agent: string }) { }; }, [agent, reload]); - const base = view === null ? null : draftOf(view.configured); + const base = useMemo( + () => (view === null ? null : draftOf(view.configured)), + [view], + ); const dirty = draft !== null && base !== null && !sameDraft(draft, base); useEffect(() => { if (draft === null || base === null) return;