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.
|
// so it stays fresh without an SSE channel.
|
||||||
if (target === 'system') fetchAndRenderToolGroups();
|
if (target === 'system') fetchAndRenderToolGroups();
|
||||||
}
|
}
|
||||||
function syncTabFromHash() {
|
|
||||||
const h = (window.location.hash || '#swarm').replace(/^#/, '');
|
|
||||||
activateTab(h);
|
|
||||||
}
|
|
||||||
window.addEventListener('hashchange', () => {
|
|
||||||
syncTabFromHash();
|
|
||||||
updateTabbarOverflow();
|
|
||||||
});
|
|
||||||
syncTabFromHash();
|
|
||||||
|
|
||||||
// ─── tabbar overflow menu ────────────────────────────────────────────────
|
// ─── tabbar overflow menu ────────────────────────────────────────────────
|
||||||
// Tabs with `data-overflow="default"` (LOGS, SETTINGS) always live in
|
// Tabs with `data-overflow="default"` (LOGS, SETTINGS) always live in
|
||||||
// the ⋮ dropdown. When the bar is too narrow to show all remaining tabs,
|
// 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).
|
// flex end. `tab-overflowed` hides a tab from the bar (display:none).
|
||||||
// The dropdown is rebuilt from scratch on every call — it holds cloned
|
// The dropdown is rebuilt from scratch on every call — it holds cloned
|
||||||
// <a>/<button> items, not the originals.
|
// <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 overflowWrap = $('tabbar-overflow');
|
||||||
const overflowBtn = $('tabbar-overflow-btn');
|
const overflowBtn = $('tabbar-overflow-btn');
|
||||||
const overflowDrop = $('tabbar-overflow-dropdown');
|
const overflowDrop = $('tabbar-overflow-dropdown');
|
||||||
let overflowOpen = false;
|
let overflowOpen = false;
|
||||||
|
|
||||||
|
function syncTabFromHash() {
|
||||||
|
const h = (window.location.hash || '#swarm').replace(/^#/, '');
|
||||||
|
activateTab(h);
|
||||||
|
}
|
||||||
|
window.addEventListener('hashchange', () => {
|
||||||
|
syncTabFromHash();
|
||||||
|
updateTabbarOverflow();
|
||||||
|
});
|
||||||
|
syncTabFromHash();
|
||||||
|
|
||||||
function closeOverflowMenu() {
|
function closeOverflowMenu() {
|
||||||
if (!overflowOpen) return;
|
if (!overflowOpen) return;
|
||||||
overflowOpen = false;
|
overflowOpen = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue