Skip to content

Commit 8341b69

Browse files
committed
Improve goToQuestion method
1 parent 99d503c commit 8341b69

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/FlowForm.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@
702702
}
703703
})
704704
705-
index = questionIndex;
705+
index = questionIndex
706706
}
707707
708708
if (index !== this.activeQuestionIndex) {
@@ -711,9 +711,13 @@
711711
if (!this.submitted && index <= this.questionListActivePath.length - 1) {
712712
// Check if we can actually jump to the wanted question.
713713
do {
714-
const previousQuestion = index > 0 ? this.questionListActivePath[index - 1] : null
714+
const previousQuestionsAnswered =
715+
this
716+
.questionListActivePath
717+
.slice(0, index)
718+
.every(q => q.answered)
715719
716-
if (previousQuestion === null || previousQuestion.answered) {
720+
if (previousQuestionsAnswered) {
717721
break
718722
}
719723

0 commit comments

Comments
 (0)