[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Object Perms: Fix toggle sections infinite spinner

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <698a424425bb7_3b1849d0904f9@gitlab-sidekiq-low-urgency-cpu-bound-v2-5cbd64784f-bwg6g.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
1c5bd11e by Moïse Nturubika at 2026-02-09T20:14:29+00:00
[FIX] Object Perms: Fix toggle sections infinite spinner
---
* [FIX] Fix infinite loop regression with async-es

* [FIX] Fix infinite loop regression with async-es

* [FIX] Object Perms: Fix toggle sections infinite spinner

See merge request tikiwiki/tiki!9371

- - - - -


1 changed file:

- src/js/jquery-tiki/tiki-async-loop.js


Changes:

=====================================
src/js/jquery-tiki/tiki-async-loop.js
=====================================
@@ -10,35 +10,34 @@ $.fn.eachAsync = function (opts) {
     } = opts;
     const array = this.toArray(); // Convert jQuery object to an array of DOM elements
     let i = 0; // Index for tracking current item
+    let batchStart = performance.now();
 
     // Process each batch of elements
     function processBatch() {
-        const batchStart = performance.now();
-
         // Use eachLimit to process a subset of elements with a concurrency of 1
         eachLimit(
             array,
             1,
-            (item, callback) => {
-                if (i < array.length && performance.now() - batchStart < bulk) {
-                    loop(item, i);
-                    i++;
-                    callback();
+            (item, next) => {
+                loop.call(item, i, item);
+                i++;
+
+                if (bulk > 0 && performance.now() - batchStart > bulk) {
+                    setTimeout(() => {
+                        batchStart = performance.now();
+                        next();
+                    }, delay);
                 } else {
-                    callback(new Error("Bulk time exceeded"));
+                    next();
                 }
             },
-            (err) => {
-                // If an error or time exceeded, schedule the next batch after a delay
-                if (i < array.length) {
-                    setTimeout(processBatch, delay);
-                } else {
-                    end();
-                }
-            }
+            () => end()
         );
     }
 
-    processBatch();
+    setTimeout(() => {
+        processBatch();
+    }, 0);
+
     return this;
 };



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1c5bd11e9e5d6b8d26b5133286090677fe325e78

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1c5bd11e9e5d6b8d26b5133286090677fe325e78
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.