From 5c8683821ee94f993d7680c18a7a8076da915c52 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 10:34:50 +0200 Subject: [PATCH] fix: preserve lazy navigation intent --- CHANGELOG.md | 2 ++ VERSION | 2 +- static/nav.js | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04f8a60..837df1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi ## [Unreleased] ### Changed +- **Lazy-navigation race protection.** A restored-section callback can no longer replace a newer user navigation + request while section-specific modules are still loading, including under CPU throttling. - **Constrained workload coverage.** Added a 4× CPU-throttled 500-character browser workload regression that records bounded DOM/audio/heap/image-cache metrics while preserving pagination. - **Bounded library image lifecycle.** Profile, concept-art, and voice-library images now use a viewport-aware diff --git a/VERSION b/VERSION index b4566e3..47e937a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.19 +1.24.20 diff --git a/static/nav.js b/static/nav.js index f1bf872..3a7ccd3 100644 --- a/static/nav.js +++ b/static/nav.js @@ -437,7 +437,14 @@ window._enginesSidebarCat = localStorage.getItem('ttsvc_engines_cat') || 'llm'; var _startSection = window._navRequestedSection || hashSection() || ((_savedSection && SECTIONS.includes(_savedSection)) ? _savedSection : 's-voices'); if (typeof window.ensureFeatureModules === 'function') { - window.ensureFeatureModules(_startSection).then(function () { showSection(_startSection); }, function () { showSection(_startSection); }); + var activateStart = function () { + // A first user click can arrive while the restored section's lazy group + // is still loading. Do not let that delayed startup callback overwrite + // the newer navigation intent (especially visible under CPU throttling). + if (window._navRequestedSection && window._navRequestedSection !== _startSection) return; + showSection(_startSection); + }; + window.ensureFeatureModules(_startSection).then(activateStart, activateStart); } else showSection(_startSection); window.addEventListener('hashchange', function () {