File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 12
12
13
13
<x-dynamic-component :component =" $getFieldWrapperView()" :field =" $field" >
14
14
<div
15
- wire:key =" {{ rand () } }"
15
+ wire:key =" {{ $ getTreeKey () } }"
16
16
wire:ignore
17
17
x-ignore
18
- @if (FilamentView:: hasSpaMode () )
18
+ @if (FilamentView:: hasSpaMode (url () -> current () ) )
19
19
ax-load =" visible"
20
20
@else
21
21
ax-load
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ class SelectTree extends Field implements HasAffixActions
88
88
89
89
protected Closure |array |null $ prepend = null ;
90
90
91
+ protected Closure |string |null $ treeKey = 'treeKey ' ;
92
+
91
93
protected function setUp (): void
92
94
{
93
95
// Load the state from relationships using a callback function.
@@ -145,6 +147,8 @@ protected function setUp(): void
145
147
$ this ->suffixActions ([
146
148
static fn (SelectTree $ component ): ?Action => $ component ->getCreateOptionAction (),
147
149
]);
150
+
151
+ $ this ->treeKey ('treeKey- ' .rand ());
148
152
}
149
153
150
154
protected function buildTree (): Collection
@@ -614,4 +618,16 @@ public function createOptionModalHeading(string|Closure|null $heading): static
614
618
615
619
return $ this ;
616
620
}
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
+ }
617
633
}
You can’t perform that action at this time.
0 commit comments