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 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-30 12:25:37 +01:00
parent 0ae6aea5f4
commit 0fb24435fc

View File

@ -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();