From 0fb24435fc4e674fa55d5be3428081e237cebf8f Mon Sep 17 00:00:00 2001 From: librelad Date: Sat, 30 May 2026 12:25:37 +0100 Subject: [PATCH] fix(webui): load component scripts in order (script.async=false) system-loader's loadScript appended scripts without async=false, so a component's scripts[] executed in download-finish order, not array order. That's a latent nondeterminism today (duplicate-method 'last wins' depended on it) and a hard blocker for splitting a class across files (a base file must run before prototype-augment files). Forcing async=false makes the boot loader honour array order, matching the kernel's ctx.loadScripts. Co-Authored-By: Claude Opus 4.8 Signed-off-by: librelad --- containers/libreportal/frontend/core/boot/system-loader.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/containers/libreportal/frontend/core/boot/system-loader.js b/containers/libreportal/frontend/core/boot/system-loader.js index caf7d14..0866044 100755 --- a/containers/libreportal/frontend/core/boot/system-loader.js +++ b/containers/libreportal/frontend/core/boot/system-loader.js @@ -1317,6 +1317,12 @@ class SystemLoader { // console.log(`📦 Loading script: ${src}`); const script = document.createElement('script'); script.src = src; + // Dynamically-inserted scripts default to async=true and run in whatever + // order they finish downloading. Force async=false so a component's + // scripts[] execute in array/insertion order — required when a class is + // split across files (a base file must run before files that augment its + // prototype). Mirrors the ordered kernel ctx.loadScripts() path. + script.async = false; script.onload = () => { // console.log(`✅ Script loaded: ${src}`); resolve();