Skip to content

Commit c9605b5

Browse files
authored
fix: prevent skipping incomplete loop steps (#3761)
1 parent cdf0fe4 commit c9605b5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/ui/src/features/loops/components/LoopForm.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ function Stepper({
446446
{STEPS.map((label, index) => {
447447
const isCurrent = index === current;
448448
const isDone = index < current && complete[index];
449-
// Steps navigate freely in both directions; skipping ahead is safe
450-
// because Next stays gated per step and Create on the whole form.
449+
const canSelect =
450+
index <= current || complete.slice(current, index).every(Boolean);
451451
return (
452452
<Flex
453453
key={label}
@@ -456,8 +456,11 @@ function Stepper({
456456
>
457457
<button
458458
type="button"
459-
onClick={() => onSelect(index)}
460-
className="flex min-w-0 cursor-pointer items-center gap-2"
459+
disabled={!canSelect}
460+
onClick={() => {
461+
if (canSelect) onSelect(index);
462+
}}
463+
className="flex min-w-0 cursor-pointer items-center gap-2 disabled:cursor-not-allowed disabled:opacity-50"
461464
>
462465
<Flex
463466
align="center"

0 commit comments

Comments
 (0)