File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1212
1313<x-dynamic-component :component =" $getFieldWrapperView()" :field =" $field" >
1414 <div
15- wire:key =" {{ rand () } }"
15+ wire:key =" {{ $ getTreeKey () } }"
1616 wire:ignore
1717 x-ignore
18- @if (FilamentView:: hasSpaMode () )
18+ @if (FilamentView:: hasSpaMode (url () -> current () ) )
1919 ax-load =" visible"
2020 @else
2121 ax-load
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ class SelectTree extends Field implements HasAffixActions
8888
8989 protected Closure |array |null $ prepend = null ;
9090
91+ protected Closure |string |null $ treeKey = 'treeKey ' ;
92+
9193 protected function setUp (): void
9294 {
9395 // Load the state from relationships using a callback function.
@@ -145,6 +147,8 @@ protected function setUp(): void
145147 $ this ->suffixActions ([
146148 static fn (SelectTree $ component ): ?Action => $ component ->getCreateOptionAction (),
147149 ]);
150+
151+ $ this ->treeKey ('treeKey- ' .rand ());
148152 }
149153
150154 protected function buildTree (): Collection
@@ -614,4 +618,16 @@ public function createOptionModalHeading(string|Closure|null $heading): static
614618
615619 return $ this ;
616620 }
621+
622+ public function treeKey (string $ treeKey ): static
623+ {
624+ $ this ->treeKey = $ treeKey ;
625+
626+ return $ this ;
627+ }
628+
629+ public function getTreeKey (): string
630+ {
631+ return $ this ->evaluate ($ this ->treeKey );
632+ }
617633}
You can’t perform that action at this time.
0 commit comments