mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
fix: Testing wizard startOnStep()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user