mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-12 11:28:58 -05:00
fix: update goToNextQuestion logic to work in last question
This commit is contained in:
@@ -191,16 +191,15 @@ export default function PreviewSurvey({
|
||||
}
|
||||
}
|
||||
}
|
||||
return questions[currentQuestionIndex + 1]?.id || "";
|
||||
return questions[currentQuestionIndex + 1]?.id || "end";
|
||||
}
|
||||
|
||||
const gotoNextQuestion = (data) => {
|
||||
const currentIndex = questions.findIndex((q) => q.id === activeQuestionId);
|
||||
const nextQuestionId = getNextQuestion(data);
|
||||
|
||||
if (currentIndex < questions.length - 1 && nextQuestionId !== "end") {
|
||||
if (currentIndex < questions.length - 1 || nextQuestionId !== "end") {
|
||||
setActiveQuestionId(nextQuestionId);
|
||||
// setActiveQuestionId(questions[currentIndex + 1].id);
|
||||
} else {
|
||||
if (thankYouCard?.enabled) {
|
||||
setActiveQuestionId("thank-you-card");
|
||||
|
||||
Reference in New Issue
Block a user