fix: add in-memory _bootFired flag to runBoot as primary dedup guard

sessionStorage alone could be bypassed in hash-URL edge cases. A module-scoped
_bootFired flag blocks any second runBoot call within the same JS context
regardless of sessionStorage state, then sessionStorage handles cross-reload
suppression. Also restores boot call in private init() to preserve original
dual-path structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 14:52:31 -04:00
parent 32f7b49f98
commit de30ff13e6
+7 -2
View File
@@ -312,10 +312,13 @@
lt.boot.run('APP NAME') lt.boot.run('APP NAME')
lt.boot.run('APP NAME', true) // force replay lt.boot.run('APP NAME', true) // force replay
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
let _bootFired = false; // in-memory guard: survives within a JS context, resets on true page reload
function runBoot(appName, force) { function runBoot(appName, force) {
if (!force && _bootFired) return; // Fastest guard — blocks any same-page double-call
const storageKey = 'lt_booted_' + (appName || 'app'); const storageKey = 'lt_booted_' + (appName || 'app');
if (!force && sessionStorage.getItem(storageKey)) return; if (!force && sessionStorage.getItem(storageKey)) return;
sessionStorage.setItem(storageKey, '1'); // Claim the run immediately to block double-init _bootFired = true;
sessionStorage.setItem(storageKey, '1');
const overlay = document.getElementById('lt-boot'); const overlay = document.getElementById('lt-boot');
const pre = document.getElementById('lt-boot-text'); const pre = document.getElementById('lt-boot-text');
if (!overlay || !pre) return; if (!overlay || !pre) return;
@@ -1333,7 +1336,9 @@
/* v1.3 */ /* v1.3 */
initMobileNav(); initMobileNav();
initSidebarSubmenus(); initSidebarSubmenus();
/* Boot is handled exclusively by lt.init() or lt.boot.run() to avoid double-init */ /* Boot */
const bootEl = document.getElementById('lt-boot');
if (bootEl) runBoot(bootEl.dataset.appName || document.title);
} }
if (document.readyState === 'loading') { if (document.readyState === 'loading') {