fix(tasks): keep generate confirmation dialog open during in-flight request

AlertDialogAction closes the dialog synchronously on click before any
awaited handler logic runs, so the disabled/'Generating...' state on the
Confirm button was unreachable. Call event.preventDefault() in
handleConfirmGenerate to suppress Radix's auto-close; the dialog now
closes explicitly via setPreview(null) only on success, and stays open
(with the toast) on error so the user can retry or cancel.
This commit is contained in:
lorentz 2026-07-18 13:10:42 +00:00
parent b8ea94e37b
commit 2906f31502

View file

@ -194,7 +194,8 @@ export function BulkAssignClient({ users, clients, designations }: BulkAssignCli
} }
} }
const handleConfirmGenerate = async () => { const handleConfirmGenerate = async (event: React.MouseEvent) => {
event.preventDefault()
setGenerating(true) setGenerating(true)
try { try {
const res = await fetch('/api/tasks/generate-and-assign', { const res = await fetch('/api/tasks/generate-and-assign', {