From 57e56d43cccfee5655f3f5867f1e27dafd509f39 Mon Sep 17 00:00:00 2001 From: Kathleen Koh Date: Wed, 3 Apr 2024 00:16:14 +0800 Subject: [PATCH] fix: correcting submission button bug for MRF --- .../public-form/components/FormEndPage/FormEndPage.tsx | 8 +++++++- .../components/FormEndPage/components/EndPageBlock.tsx | 8 +++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/features/public-form/components/FormEndPage/FormEndPage.tsx b/frontend/src/features/public-form/components/FormEndPage/FormEndPage.tsx index c3eb632e64..f467587122 100644 --- a/frontend/src/features/public-form/components/FormEndPage/FormEndPage.tsx +++ b/frontend/src/features/public-form/components/FormEndPage/FormEndPage.tsx @@ -2,7 +2,10 @@ import { Container, Flex, Stack, StackDivider } from '@chakra-ui/react' import { FormColorTheme, FormDto } from '~shared/types/form' -import { SubmissionData } from '~features/public-form/PublicFormContext' +import { + SubmissionData, + usePublicFormContext, +} from '~features/public-form/PublicFormContext' import { EndPageBlock } from './components/EndPageBlock' import { FeedbackBlock, FeedbackFormInput } from './components/FeedbackBlock' @@ -23,6 +26,8 @@ export const FormEndPage = ({ colorTheme, ...endPageProps }: FormEndPageProps): JSX.Element => { + const { previousSubmissionId } = usePublicFormContext() + return ( @@ -39,6 +44,7 @@ export const FormEndPage = ({ focusOnMount {...endPageProps} colorTheme={colorTheme} + previousSubmissionId={previousSubmissionId} /> {isFeedbackSectionHidden ? null : ( { const focusRef = useRef(null) useEffect(() => { @@ -56,7 +55,6 @@ export const EndPageBlock = ({ return 'You have successfully submitted your response.' }, [formTitle]) - const { previousSubmissionId } = usePublicFormContext() const disableSubmitResponseButton = !!previousSubmissionId //disable for MRF 2nd respondent onwards return (