From cdd93ee86b301a801304073ce8a812a256ab2aec Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:07:42 +0530 Subject: [PATCH] fix: Cta button issue on thank you card (#2148) Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com> Co-authored-by: Johannes --- .../(analysis)/summary/components/ShareEmbedSurvey.tsx | 2 +- apps/web/app/s/[surveyId]/components/LinkSurvey.tsx | 10 +++++++--- packages/surveys/src/components/general/Survey.tsx | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ShareEmbedSurvey.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ShareEmbedSurvey.tsx index 60b04797b9..4dbbad2dab 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ShareEmbedSurvey.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ShareEmbedSurvey.tsx @@ -94,7 +94,7 @@ export default function ShareEmbedSurvey({ survey, open, setOpen, webAppUrl, use
handleTextSelection()}> {surveyUrl} diff --git a/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx b/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx index 0257c27572..62d521e038 100644 --- a/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx +++ b/apps/web/app/s/[surveyId]/components/LinkSurvey.tsx @@ -162,9 +162,13 @@ export default function LinkSurvey({ getSetIsError={(f: (value: boolean) => void) => { setIsError = f; }} - getSetIsResponseSendingFinished={(f: (value: boolean) => void) => { - setIsResponseSendingFinished = f; - }} + getSetIsResponseSendingFinished={ + !isPreview + ? (f: (value: boolean) => void) => { + setIsResponseSendingFinished = f; + } + : undefined + } onRetry={() => { setIsError(false); responseQueue.processQueue(); diff --git a/packages/surveys/src/components/general/Survey.tsx b/packages/surveys/src/components/general/Survey.tsx index d240ce4f93..f19b21a26c 100644 --- a/packages/surveys/src/components/general/Survey.tsx +++ b/packages/surveys/src/components/general/Survey.tsx @@ -37,8 +37,10 @@ export function Survey({ activeQuestionId || (survey.welcomeCard.enabled ? "start" : survey?.questions[0]?.id) ); const [showError, setShowError] = useState(false); - // flag state to store whether response processing has been completed or not - const [isResponseSendingFinished, setIsResponseSendingFinished] = useState(false); + // flag state to store whether response processing has been completed or not, we ignore this check for survey editor preview and link survey preview where getSetIsResponseSendingFinished is undefined + const [isResponseSendingFinished, setIsResponseSendingFinished] = useState( + getSetIsResponseSendingFinished ? false : true + ); const [loadingElement, setLoadingElement] = useState(false); const [history, setHistory] = useState([]);