Skip to content

Commit 8786b1e

Browse files
waleedlatif1claude
andcommitted
fix(data-drains): surface CreateDrainModal submit error inline
Completes the modal-error migration: the create-drain form's submit failure now renders via ChipModalError in the modal body (the modal stays open) instead of a toast.error that escaped to the screen corner. The success-on-close toast and the page-level drain-row action toasts are unchanged (correct). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 91e89f4 commit 8786b1e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/sim/ee/data-drains/components/data-drains-settings.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ChipInput,
1414
ChipModal,
1515
ChipModalBody,
16+
ChipModalError,
1617
ChipModalField,
1718
ChipModalFooter,
1819
ChipModalHeader,
@@ -419,6 +420,7 @@ function CreateDrainModal({ organizationId, onClose }: CreateDrainModalProps) {
419420
const [destState, setDestState] = useState<unknown>(
420421
() => DESTINATION_FORM_REGISTRY[DESTINATION_TYPES[0]].initialState
421422
)
423+
const [submitError, setSubmitError] = useState<string | null>(null)
422424

423425
const spec = DESTINATION_FORM_REGISTRY[destinationType]
424426
const canSubmit = name.trim().length > 0 && spec.isComplete(destState)
@@ -430,6 +432,7 @@ function CreateDrainModal({ organizationId, onClose }: CreateDrainModalProps) {
430432

431433
async function handleSubmit() {
432434
if (!canSubmit) return
435+
setSubmitError(null)
433436
try {
434437
const body = {
435438
name: name.trim(),
@@ -443,7 +446,7 @@ function CreateDrainModal({ organizationId, onClose }: CreateDrainModalProps) {
443446
} catch (error) {
444447
const msg = toError(error).message
445448
logger.error('Failed to create data drain', { error: msg })
446-
toast.error(msg)
449+
setSubmitError(msg)
447450
}
448451
}
449452

@@ -488,6 +491,7 @@ function CreateDrainModal({ organizationId, onClose }: CreateDrainModalProps) {
488491
<section className='flex flex-col gap-3 px-2'>
489492
<spec.FormFields state={destState} setState={setDestState} />
490493
</section>
494+
<ChipModalError>{submitError}</ChipModalError>
491495
</ChipModalBody>
492496
<ChipModalFooter
493497
onCancel={onClose}

0 commit comments

Comments
 (0)