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) {
7272 this .$wire .on (' menu-items-updated' , () => {
7373 this .refreshMenuItems ();
7474 });
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+ });
7580 },
7681
7782 refreshMenuItems () {
@@ -122,10 +127,11 @@ function menuItemsManager(config) {
122127 // Call the Livewire method to save the new order
123128 this .$wire .reorderMenuItems (items).then (() => {
124129 this .loading = false ;
130+ // Don't manually refresh - the server-side refreshTree() will handle it
125131 }).catch ((error ) => {
126132 console .error (' Reorder failed:' , error);
127133 this .loading = false ;
128- // Revert the visual change by refreshing
134+ // Only refresh on error to revert changes
129135 this .refreshMenuItems ();
130136 });
131137 },
Original file line number Diff line number Diff line change @@ -325,7 +325,9 @@ public function reorderMenuItems(array $orderedItems): void
325325 // Process the reordering with proper nested set operations
326326 $ this ->processNestedSetReorder ($ orderedItems );
327327
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 ' );
329331
330332 Notification::make ()
331333 ->title (flexiblePagesTrans ('menu_items.messages.items_reordered ' ))
You can’t perform that action at this time.
0 commit comments