@@ -27,12 +27,10 @@ class="space-y-6"
2727 <!-- Tree Items -->
2828 <div class =" space-y-2" id =" menu-items-container" wire:key =" tree-{{ $refreshKey } }" >
2929 @foreach ($this -> record -> menuItems ()-> with ([' children' , ' linkable' ])-> whereNull (' parent_id' )-> orderBy (' _lft' )-> get () as $item )
30- <div data-item-id =" {{ $item -> id } }" >
31- @livewire (' filament-flexible-content-block-pages::menu-tree-item' , [
32- ' item' => $item ,
33- ' maxDepth' => $this -> getMaxDepth ()
34- ], key (" item-{$item -> id }-{$refreshKey }" ) )
35- </div >
30+ @livewire (' filament-flexible-content-block-pages::menu-tree-item' , [
31+ ' item' => $item ,
32+ ' maxDepth' => $this -> getMaxDepth ()
33+ ], key (" item-{$item -> id }-{$refreshKey }" ) )
3634 @endforeach
3735 </div >
3836 @endif
@@ -72,11 +70,6 @@ function menuItemsManager(config) {
7270 this .$wire .on (' menu-items-updated' , () => {
7371 this .refreshMenuItems ();
7472 });
75-
76- // Listen for reorder completion (no need to refresh, just hide loading)
77- this .$wire .on (' menu-items-reordered' , () => {
78- this .loading = false ;
79- });
8073 },
8174
8275 refreshMenuItems () {
@@ -125,15 +118,7 @@ function menuItemsManager(config) {
125118 });
126119
127120 // Call the Livewire method to save the new order
128- this .$wire .reorderMenuItems (items).then (() => {
129- this .loading = false ;
130- // Don't manually refresh - the server-side refreshTree() will handle it
131- }).catch ((error ) => {
132- console .error (' Reorder failed:' , error);
133- this .loading = false ;
134- // Only refresh on error to revert changes
135- this .refreshMenuItems ();
136- });
121+ this .$wire .reorderMenuItems (items);
137122 },
138123
139124 extractItemId (element ) {
0 commit comments