Skip to content

Commit 0ec51ec

Browse files
nickmazziclaude
andcommitted
fix(autorag): separate error handling and prevent dismissal during save in LlamaStackConnectionModal
Split the single try/catch into two blocks so a createSecret failure is reported independently from an onSubmit failure, preventing a downstream refresh error from masking a successful create. Also prevent modal dismissal while saving by disabling the X button, Escape key, and Cancel button during in-flight requests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 43d001a commit 0ec51ec

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/autorag/frontend/src/app/components/common/LlamaStackConnectionModal.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ const LlamaStackConnectionModal: React.FC<Props> = ({ namespace, onClose, onSubm
6868

6969
try {
7070
await createSecret(secret);
71+
} catch (e) {
72+
setSubmitError(e instanceof Error ? e : new Error(String(e)));
73+
setIsSaving(false);
74+
return;
75+
}
76+
77+
try {
7178
await onSubmit(k8sName);
7279
onClose();
7380
} catch (e) {
@@ -78,7 +85,7 @@ const LlamaStackConnectionModal: React.FC<Props> = ({ namespace, onClose, onSubm
7885
};
7986

8087
return (
81-
<Modal isOpen onClose={onClose} variant="medium">
88+
<Modal isOpen onClose={isSaving ? undefined : onClose} variant="medium">
8289
<ModalHeader
8390
title="Add Llama Stack connection"
8491
description="Provide credentials for accessing an external Llama Stack server. The generation and embedding models registered in the Llama Stack server will be considered when generating RAG patterns. Vector I/O providers in the Llama Stack server can be used to store a collection for the retrieval."
@@ -139,6 +146,7 @@ const LlamaStackConnectionModal: React.FC<Props> = ({ namespace, onClose, onSubm
139146
onSubmit={handleSubmit}
140147
error={submitError}
141148
isSubmitDisabled={!isFormValid || isSaving}
149+
isCancelDisabled={isSaving}
142150
isSubmitLoading={isSaving}
143151
alertTitle="Failed to create connection"
144152
/>

0 commit comments

Comments
 (0)