[FIX] RACI + Competenze: stesso anti-loop MutationObserver+createIcons dell'organigramma

Prevenzione proattiva dello stesso freeze latente trovato in organigramma: le pagine
raci.html e competenze.html richiamavano createIcons() su ogni mutazione DOM. Debounce+disconnect.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
DevEnv nis2-agile
2026-08-25 18:15:21 +02:00
co-authored by Claude Opus 4.8
parent 9eeef784d4
commit 69f3894c18
2 changed files with 22 additions and 2 deletions
+11 -1
View File
@@ -206,7 +206,17 @@
v3Icons();
var root = document.querySelector('main.wrap');
if (root && window.MutationObserver) {
var mo = new MutationObserver(function () { v3Icons(); });
// Anti-loop: createIcons() muta il DOM (<i>->svg) → osservare "ogni mutazione"
// e ri-chiamarlo puo' auto-ritriggerarsi (freeze). Debounce + disconnect.
var applying = false, timer = null;
var mo = new MutationObserver(function () {
if (applying) return;
clearTimeout(timer);
timer = setTimeout(function () {
applying = true; mo.disconnect(); v3Icons();
mo.observe(root, { childList: true, subtree: true }); applying = false;
}, 120);
});
mo.observe(root, { childList: true, subtree: true });
}
});