From ccc57dc72bbfa11fac85baf4fa930914ae61f8f1 Mon Sep 17 00:00:00 2001 From: Marcus Quinn Date: Mon, 24 Mar 2025 20:26:28 +0000 Subject: [PATCH] Fix duplicate loading spinners in Free Plugins tab --- admin/includes/class-free-plugins-manager.php | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/admin/includes/class-free-plugins-manager.php b/admin/includes/class-free-plugins-manager.php index 988a89e..de88bc0 100644 --- a/admin/includes/class-free-plugins-manager.php +++ b/admin/includes/class-free-plugins-manager.php @@ -81,9 +81,12 @@ class WP_Allstars_Free_Plugins_Manager {
-
-
- +
+ +
+ +

Loading plugin data...

+
@@ -94,16 +97,16 @@ class WP_Allstars_Free_Plugins_Manager { e.preventDefault(); var category = $(this).data('category'); + var $container = $('#wpa-plugin-list'); // Update filter UI $('#wpa-plugin-filters .filter-links a').removeClass('current'); $(this).addClass('current'); - // Show loading spinner - $('.wp-allstars-loading-overlay').show(); - - // Clear existing plugins - $('#wpa-plugin-list').empty(); + // Create new loading overlay + $container.empty(); + var $loadingOverlay = $('

Loading plugin data...

'); + $container.append($loadingOverlay); // Load plugins in selected category $.ajax({ @@ -115,18 +118,20 @@ class WP_Allstars_Free_Plugins_Manager { nonce: '' }, success: function(response) { + $loadingOverlay.remove(); + if (response.success) { - // Hide loading spinner - $('.wp-allstars-loading-overlay').hide(); - // Add plugins to the container - $('#wpa-plugin-list').html(response.data); + $container.html(response.data); } else { + $container.html('

' + response.data + '

'); console.error('Error loading plugins:', response.data); } }, error: function(xhr, status, error) { - console.error('AJAX error:', error); + $loadingOverlay.remove(); + $container.html('

Failed to load plugins. Please try again. Error: ' + error + '

'); + console.error('AJAX error:', xhr.responseText); } }); });