fix(ui): deduplicate agent catalog error messages in CreateProjectAgentSheet (#2428)
This commit is contained in:
parent
cbaffd2cb4
commit
608333bd54
|
|
@ -58,6 +58,11 @@ export function CreateProjectAgentSheet({
|
|||
? agentsQuery.error.message
|
||||
: "Could not load agent catalog."
|
||||
: null;
|
||||
const displayError = refreshAgentsMutation.isError
|
||||
? refreshAgentsMutation.error instanceof Error
|
||||
? refreshAgentsMutation.error.message
|
||||
: "Could not refresh agent catalog."
|
||||
: agentsError;
|
||||
const [workerAgent, setWorkerAgent] = useState("");
|
||||
const [orchestratorAgent, setOrchestratorAgent] = useState("");
|
||||
const [intake, setIntake] = useState<IntakeForm>(EMPTY_INTAKE);
|
||||
|
|
@ -143,12 +148,13 @@ export function CreateProjectAgentSheet({
|
|||
</button>
|
||||
</div>
|
||||
|
||||
{agentsError && (
|
||||
{displayError && (
|
||||
<div className="flex items-center justify-between gap-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] leading-5 text-destructive">
|
||||
<span>{agentsError}</span>
|
||||
<span>{displayError}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="shrink-0 rounded text-foreground underline-offset-2 hover:underline"
|
||||
className="shrink-0 rounded text-foreground underline-offset-2 hover:underline disabled:pointer-events-none disabled:opacity-50"
|
||||
disabled={refreshAgentsMutation.isPending}
|
||||
onClick={() => refreshAgentsMutation.mutate()}
|
||||
>
|
||||
Retry
|
||||
|
|
@ -156,14 +162,6 @@ export function CreateProjectAgentSheet({
|
|||
</div>
|
||||
)}
|
||||
|
||||
{refreshAgentsMutation.isError && (
|
||||
<div className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] leading-5 text-destructive">
|
||||
{refreshAgentsMutation.error instanceof Error
|
||||
? refreshAgentsMutation.error.message
|
||||
: "Could not refresh agent catalog."}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="border-t border-border pt-4">
|
||||
<IntakeFields form={intake} onChange={(patch) => setIntake((f) => ({ ...f, ...patch }))} compact />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue