-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Problem
Three places use window.confirm() — a synchronous browser API that blocks the entire JavaScript event loop, causing long tasks and poor INP scores. Chrome on Android may silently suppress it entirely.
| File | Issue |
|---|---|
components/clients/ArchiveClientButton.tsx:19 |
window.confirm() before archive |
components/tasks/AttachmentsList.tsx:139 |
window.confirm() before delete attachment |
components/comments/CommentThread.tsx:54 |
window.confirm() before delete comment |
Fix
Replace each window.confirm() with a controlled <Dialog> — the same pattern already used in DeleteTaskButton. Each trigger button opens the dialog instantly (zero latency), and the destructive action lives in the dialog footer.
// Pattern (ArchiveClientButton example)
const [confirmOpen, setConfirmOpen] = useState(false);
<Button onClick={() => setConfirmOpen(true)}>Archive</Button>
<Dialog open={confirmOpen} onOpenChange={setConfirmOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Archive this client?</DialogTitle>
<DialogDescription>They will be hidden from the active client list.</DialogDescription>
</DialogHeader>
<DialogFooter>
<DialogClose asChild><Button variant="outline">Cancel</Button></DialogClose>
<Button variant="destructive" disabled={isPending} onClick={handleArchive}>
{isPending ? "Archiving…" : "Archive"}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>Acceptance criteria
-
ArchiveClientButtonuses Dialog instead ofwindow.confirm() -
AttachmentsListdelete uses Dialog instead ofwindow.confirm() -
CommentRowdelete uses Dialog instead ofwindow.confirm() - No
window.confirm()orwindow.alert()calls remain in the codebase -
npm run buildpasses
Reactions are currently unavailable