diff --git a/apps/comments-ui/src/components/popups/DeletePopup.tsx b/apps/comments-ui/src/components/popups/DeletePopup.tsx index adb1b3a1b4..09bd5a1654 100644 --- a/apps/comments-ui/src/components/popups/DeletePopup.tsx +++ b/apps/comments-ui/src/components/popups/DeletePopup.tsx @@ -8,6 +8,7 @@ import {useState} from 'react'; const DeletePopup = ({comment}: {comment: Comment}) => { const {dispatchAction, t} = useAppContext(); const [progress, setProgress] = useState('default'); + const [isSubmitting, setIsSubmitting] = useState(false); let buttonColor = 'bg-red-600'; if (progress === 'sent') { @@ -44,6 +45,12 @@ const DeletePopup = ({comment}: {comment: Comment}) => { const submit = (event: React.MouseEvent) => { event.stopPropagation(); + // Prevent multiple submissions + if (isSubmitting) { + return; + } + + setIsSubmitting(true); setProgress('sending'); setTimeout(() => { @@ -66,6 +73,7 @@ const DeletePopup = ({comment}: {comment: Comment}) => {