diff --git a/src/SelectTree.php b/src/SelectTree.php index ac4963f..d259284 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -168,7 +168,7 @@ protected function setUp(): void static fn (SelectTree $component): ?Action => $component->getCreateOptionAction(), ]); - $this->treeKey('treeKey-'.rand()); + $this->treeKey(fn (SelectTree $component): string => 'treeKey-'.$component->getStatePath()); } protected function buildTree(): Collection @@ -810,7 +810,7 @@ public function createOptionModalHeading(string|Closure|null $heading): static return $this; } - public function treeKey(string $treeKey): static + public function treeKey(Closure|string $treeKey): static { $this->treeKey = $treeKey;