fix(#1015,#1016): declare overflow vars before syncTabFromHash() call
overflowBtn/overflowDrop/overflowWrap were declared after syncTabFromHash() was invoked. activateTab() calls updateTabbarOverflow() which closes over these consts — hitting them in the TDZ threw ReferenceError on every page load, also preventing fetchAndRenderToolGroups() from running (tool-groups section stuck at loading).
This commit is contained in:
parent
912f9c5ed2
commit
6c75030420
1 changed files with 15 additions and 10 deletions
|
|
@ -3487,16 +3487,6 @@ window.marked = marked;
|
|||
// so it stays fresh without an SSE channel.
|
||||
if (target === 'system') fetchAndRenderToolGroups();
|
||||
}
|
||||
function syncTabFromHash() {
|
||||
const h = (window.location.hash || '#swarm').replace(/^#/, '');
|
||||
activateTab(h);
|
||||
}
|
||||
window.addEventListener('hashchange', () => {
|
||||
syncTabFromHash();
|
||||
updateTabbarOverflow();
|
||||
});
|
||||
syncTabFromHash();
|
||||
|
||||
// ─── tabbar overflow menu ────────────────────────────────────────────────
|
||||
// Tabs with `data-overflow="default"` (LOGS, SETTINGS) always live in
|
||||
// the ⋮ dropdown. When the bar is too narrow to show all remaining tabs,
|
||||
|
|
@ -3506,12 +3496,27 @@ window.marked = marked;
|
|||
// flex end. `tab-overflowed` hides a tab from the bar (display:none).
|
||||
// The dropdown is rebuilt from scratch on every call — it holds cloned
|
||||
// <a>/<button> items, not the originals.
|
||||
//
|
||||
// IMPORTANT: these must be declared before syncTabFromHash() is called
|
||||
// below — activateTab() calls updateTabbarOverflow() which closes over
|
||||
// these variables, and const/let are not accessible before their
|
||||
// declaration (TDZ).
|
||||
|
||||
const overflowWrap = $('tabbar-overflow');
|
||||
const overflowBtn = $('tabbar-overflow-btn');
|
||||
const overflowDrop = $('tabbar-overflow-dropdown');
|
||||
let overflowOpen = false;
|
||||
|
||||
function syncTabFromHash() {
|
||||
const h = (window.location.hash || '#swarm').replace(/^#/, '');
|
||||
activateTab(h);
|
||||
}
|
||||
window.addEventListener('hashchange', () => {
|
||||
syncTabFromHash();
|
||||
updateTabbarOverflow();
|
||||
});
|
||||
syncTabFromHash();
|
||||
|
||||
function closeOverflowMenu() {
|
||||
if (!overflowOpen) return;
|
||||
overflowOpen = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue