fix(tasks): block Cancel and Escape from closing generate dialog mid-request
AlertDialogCancel and Escape both closed the confirmation dialog via Radix's default onOpenChange(false) while the generate-and-assign fetch was still in flight, leaving an orphaned request that could resolve after the user believed they'd cancelled and could leave `generating` stuck true. Disable Cancel and suppress onEscapeKeyDown while `generating` is true so the dialog can only close intentionally once the request settles.
This commit is contained in:
parent
2906f31502
commit
db7ea9fc86
1 changed files with 6 additions and 2 deletions
|
|
@ -329,7 +329,11 @@ export function BulkAssignClient({ users, clients, designations }: BulkAssignCli
|
|||
</Card>
|
||||
|
||||
<AlertDialog open={!!preview} onOpenChange={(open) => { if (!open) setPreview(null) }}>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogContent
|
||||
onEscapeKeyDown={(event) => {
|
||||
if (generating) event.preventDefault()
|
||||
}}
|
||||
>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
Generate {preview?.totalEstimatedTasks} task{preview && preview.totalEstimatedTasks !== 1 ? 's' : ''}?
|
||||
|
|
@ -358,7 +362,7 @@ export function BulkAssignClient({ users, clients, designations }: BulkAssignCli
|
|||
</Table>
|
||||
</div>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={generating}>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={handleConfirmGenerate} disabled={generating}>
|
||||
{generating ? 'Generating...' : 'Confirm'}
|
||||
</AlertDialogAction>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue