From e48441facb0fde1120d71f0276d99a8f2325b8bb Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Tue, 5 Nov 2024 14:23:15 -0600 Subject: [PATCH] Disable submission and editing once the user has clicked the submit button. --- .../feedback_submit_form/FeedbackSubmitForm.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx b/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx index df169e48a8..0cce738fa0 100644 --- a/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx +++ b/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx @@ -78,6 +78,7 @@ const FeedbackSubmitForm = ({ const { state, dispatch } = useContext(AppContext); const csrf = selectCsrfToken(state); const [isLoading, setIsLoading] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false); const [isReviewing, setIsReviewing] = useState(reviewOnly); const history = useHistory(); const [questionAnswerPairs, setQuestionAnswerPairs] = useState([]); @@ -117,6 +118,7 @@ const FeedbackSubmitForm = ({ } const onSubmitHandler = () => { + setIsSubmitting(true); updateAllAnswersSubmit() .then(res => { for (let i = 0; i < res.length; ++i) { @@ -135,9 +137,11 @@ const FeedbackSubmitForm = ({ }) .then(resTwo => { if (resTwo === false) { + setIsSubmitting(false); return; } updateRequestSubmit().then(res => { + setIsSubmitting(false); if (res && res.payload && res.payload.data && !res.error) { history.push(`/feedback/submit/confirmation/?request=${requestId}`); } else { @@ -225,7 +229,7 @@ const FeedbackSubmitForm = ({