File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ function menuItemsManager(config) {
72
72
this .$wire .on (' menu-items-updated' , () => {
73
73
this .refreshMenuItems ();
74
74
});
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
+ });
75
80
},
76
81
77
82
refreshMenuItems () {
@@ -122,10 +127,11 @@ function menuItemsManager(config) {
122
127
// Call the Livewire method to save the new order
123
128
this .$wire .reorderMenuItems (items).then (() => {
124
129
this .loading = false ;
130
+ // Don't manually refresh - the server-side refreshTree() will handle it
125
131
}).catch ((error ) => {
126
132
console .error (' Reorder failed:' , error);
127
133
this .loading = false ;
128
- // Revert the visual change by refreshing
134
+ // Only refresh on error to revert changes
129
135
this .refreshMenuItems ();
130
136
});
131
137
},
Original file line number Diff line number Diff line change @@ -325,7 +325,9 @@ public function reorderMenuItems(array $orderedItems): void
325
325
// Process the reordering with proper nested set operations
326
326
$ this ->processNestedSetReorder ($ orderedItems );
327
327
328
- $ this ->refreshTree ();
328
+ // Don't refresh tree for reordering - the visual order is already correct
329
+ // Only dispatch event for JavaScript to hide loading state
330
+ $ this ->dispatch ('menu-items-reordered ' );
329
331
330
332
Notification::make ()
331
333
->title (flexiblePagesTrans ('menu_items.messages.items_reordered ' ))
You can’t perform that action at this time.
0 commit comments