From 7f9a6aaccfd9d5de47e4e60e7079db87af1ab356 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Sun, 22 Jun 2025 17:35:31 +0100 Subject: [PATCH] fix: Testing wizard `startOnStep()` --- packages/forms/src/Components/Wizard.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/forms/src/Components/Wizard.php b/packages/forms/src/Components/Wizard.php index 6b13de47ed..88bf07a931 100644 --- a/packages/forms/src/Components/Wizard.php +++ b/packages/forms/src/Components/Wizard.php @@ -30,7 +30,7 @@ class Wizard extends Component protected int | Closure $startStep = 1; - protected int $currentStepIndex = 0; + protected ?int $currentStepIndex = null; /** * @var view-string @@ -60,8 +60,6 @@ class Wizard extends Component { parent::setUp(); - $this->setCurrentStepIndex($this->getStartStep() - 1); - $this->registerActions([ fn (Wizard $component): Action => $component->getNextAction(), fn (Wizard $component): Action => $component->getPreviousAction(), @@ -268,7 +266,7 @@ class Wizard extends Component public function getCurrentStepIndex(): int { - return $this->currentStepIndex; + return $this->currentStepIndex ??= ($this->getStartStep() - 1); } protected function setCurrentStepIndex(int $index): static