cockpit/js/modifiers.js in cpee-2.1.51 vs cockpit/js/modifiers.js in cpee-2.1.52

- old
+ new

@@ -59,11 +59,13 @@ promises.push( $.ajax({ url: rep + 'modifiers/' }).then(async function(res) { let ipromises = []; + let iinserts = {}; $('resource',res).each(function(_,r) { + iinserts[$(r).text()] = ''; ipromises.push( $.ajax({ url: rep + 'modifiers/' + $(r).text() }).then(async function(ses){ let clone = document.importNode(document.querySelector('#modifiers template').content,true); @@ -85,16 +87,21 @@ save['modifiers'][$(r).text() + '/' + $(s).text()] = tes; }) ); }); - $(clone).insertBefore($('#modifiers template')); + iinserts[$(r).text()] = $(clone); await Promise.all(cpromises); }) ); }); await Promise.all(ipromises); + + // always insert in order + for (const [_, fragment] of Object.entries(iinserts)) { + fragment.insertBefore($('#modifiers template')); + } }) ); await Promise.all(promises); }