diff --git a/public/views/settings.js b/public/views/settings.js index 41d0276..17f7318 100644 --- a/public/views/settings.js +++ b/public/views/settings.js @@ -101,16 +101,22 @@ export async function render(main) { const tokensBody = el('div', { class: 'settings-body' }); const agentsBody = el('div', { class: 'settings-body' }); - // Icon sets — collapsible; panel is lazy-created once but hidden by default. - const isPanel = iconSetsPanel(); - isPanel.style.display = 'none'; + // Icon sets — collapsible; panel is lazy-created on first expand so + // /api/icon-sets is not fetched while the section is collapsed. + let isPanel = null; + const iconSetsWrap = el('div', { class: 'settings-body' }); const isToggle = el('button', { class: 'ghost' }, '▸ Icon sets'); isToggle.addEventListener('click', () => { + if (!isPanel) { + // First expand: create and append the panel. + isPanel = iconSetsPanel(); + iconSetsWrap.appendChild(isPanel); + } const open = isPanel.style.display !== 'none'; isPanel.style.display = open ? 'none' : 'block'; isToggle.textContent = (open ? '▸' : '▾') + ' Icon sets'; }); - const iconSetsWrap = el('div', { class: 'settings-body' }, isToggle, isPanel); + iconSetsWrap.appendChild(isToggle); mount(main, el('h1', { class: 'view-h1' }, '◆ Settings'),