mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: Preview not showing correctly after changing the survey type (#852)
This commit is contained in:
committed by
GitHub
parent
6c8d14409c
commit
a3549cc92c
@@ -46,8 +46,8 @@ export default function SurveyEditor({
|
||||
|
||||
// when the survey type changes, we need to reset the active question id to the first question
|
||||
useEffect(() => {
|
||||
if (survey?.questions?.length > 0) {
|
||||
setActiveQuestionId(survey.questions[0].id);
|
||||
if (localSurvey && localSurvey.questions?.length > 0) {
|
||||
setActiveQuestionId(localSurvey.questions[0].id);
|
||||
}
|
||||
}, [localSurvey?.type]);
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ export default function WhenToSendCard({
|
||||
setLocalSurvey(updatedSurvey);
|
||||
};
|
||||
useEffect(() => {
|
||||
console.log(actionClassArray);
|
||||
if (activeIndex !== null) {
|
||||
setTriggerEvent(activeIndex, actionClassArray[actionClassArray.length - 1].id);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export function Survey({
|
||||
isRedirectDisabled = false,
|
||||
prefillResponseData,
|
||||
}: SurveyBaseProps) {
|
||||
const [questionId, setQuestionId] = useState(activeQuestionId || survey.questions[0].id);
|
||||
const [questionId, setQuestionId] = useState(activeQuestionId || survey.questions[0]?.id);
|
||||
const [loadingElement, setLoadingElement] = useState(false);
|
||||
const [history, setHistory] = useState<string[]>([]);
|
||||
const [responseData, setResponseData] = useState<TResponseData>({});
|
||||
|
||||
Reference in New Issue
Block a user