mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-05-08 13:58:55 -04:00
fix(wizard): skip unchosen branch steps during linear progression
When the wizard makes a branch choice, mark all other branch targets as skipped. Linear progression now advances past skipped steps, so path 1→2→4 no longer executes step 3 when branch A was chosen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -792,8 +792,11 @@ export const WizardInterface = React.memo(function WizardInterface({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: Linear progression
|
// Default: Linear progression (skip steps marked as skipped by branching)
|
||||||
const nextIndex = currentStepIndex + 1;
|
let nextIndex = currentStepIndex + 1;
|
||||||
|
while (nextIndex < steps.length && skippedSteps.has(nextIndex)) {
|
||||||
|
nextIndex++;
|
||||||
|
}
|
||||||
if (nextIndex < steps.length) {
|
if (nextIndex < steps.length) {
|
||||||
// Mark current step as complete
|
// Mark current step as complete
|
||||||
setCompletedSteps((prev) => {
|
setCompletedSteps((prev) => {
|
||||||
@@ -942,6 +945,24 @@ export const WizardInterface = React.memo(function WizardInterface({
|
|||||||
console.log(
|
console.log(
|
||||||
`[WizardInterface] Choice-based jump to step ${targetIndex} (${nextId})`,
|
`[WizardInterface] Choice-based jump to step ${targetIndex} (${nextId})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Mark other branch targets as skipped so linear progression bypasses them
|
||||||
|
const branchingStep = steps[currentStepIndex];
|
||||||
|
const allOptions =
|
||||||
|
(branchingStep?.conditions?.options as any[]) ?? [];
|
||||||
|
setSkippedSteps((prev) => {
|
||||||
|
const next = new Set(prev);
|
||||||
|
for (const opt of allOptions) {
|
||||||
|
if (opt.nextStepId && opt.nextStepId !== nextId) {
|
||||||
|
const otherIdx = steps.findIndex(
|
||||||
|
(s) => s.id === opt.nextStepId,
|
||||||
|
);
|
||||||
|
if (otherIdx !== -1) next.add(otherIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
|
||||||
handleNextStep(targetIndex);
|
handleNextStep(targetIndex);
|
||||||
return; // Exit after jump
|
return; // Exit after jump
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user