Skip to content

Commit b7603cd

Browse files
timedin-demickenordin
authored andcommitted
fix: multiple active branches
Signed-off-by: TimedIn <git@timedin.net>
1 parent b63349a commit b7603cd

1 file changed

Lines changed: 26 additions & 20 deletions

File tree

src/components/Questions/QuestionConditional.vue

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,30 @@
282282
</div>
283283

284284
<!-- Submit Mode: Show only the active branch's subquestions -->
285-
<div v-else-if="activeBranch" class="active-subquestions">
286-
<component
287-
:is="getSubQuestionComponentName(subQuestion.type)"
288-
v-for="(subQuestion, subIndex) in activeBranch.subQuestions"
289-
:key="subQuestion.id"
290-
ref="subQuestions"
291-
v-bind="subQuestion"
292-
:formId="formId"
293-
:index="subIndex + index + 1"
294-
:maxStringLengths="maxStringLengths"
295-
:answerType="
296-
getSubQuestionAnswerTypeConfig(subQuestion.type)
297-
"
298-
:readOnly="true"
299-
:values="getSubQuestionValues(subQuestion.id)"
300-
@update:values="
301-
onSubQuestionValueChange(subQuestion.id, $event)
302-
" />
285+
<div v-else-if="activeBranches?.length" class="active-subquestions">
286+
<div
287+
v-for="activeBranch in activeBranches"
288+
:key="activeBranch.id">
289+
<component
290+
:is="getSubQuestionComponentName(subQuestion.type)"
291+
v-for="(
292+
subQuestion, subIndex
293+
) in activeBranch.subQuestions"
294+
:key="subQuestion.id"
295+
ref="subQuestions"
296+
v-bind="subQuestion"
297+
:formId="formId"
298+
:index="subIndex + index + 1"
299+
:maxStringLengths="maxStringLengths"
300+
:answerType="
301+
getSubQuestionAnswerTypeConfig(subQuestion.type)
302+
"
303+
:readOnly="true"
304+
:values="getSubQuestionValues(subQuestion.id)"
305+
@update:values="
306+
onSubQuestionValueChange(subQuestion.id, $event)
307+
" />
308+
</div>
303309
</div>
304310
</div>
305311
</div>
@@ -554,11 +560,11 @@ export default {
554560
return this.extraSettings?.branches || []
555561
},
556562
557-
activeBranch() {
563+
activeBranches() {
558564
if (!this.triggerValues || this.triggerValues.length === 0) {
559565
return null
560566
}
561-
return this.branches.find((branch) =>
567+
return this.branches.filter((branch) =>
562568
this.evaluateBranchCondition(branch),
563569
)
564570
},

0 commit comments

Comments
 (0)