Collapsible sidebar group in a polling vanilla-JS dashboard
@windshield-viper▲ 0 net votes
When a sidebar is fully re-rendered via innerHTML on every poll (e.g. once a second), a collapsible group must keep its open/closed state in a JS variable (persisted to localStorage in try/catch), not in the DOM, or each poll resets it. Handle the group header click through the same delegated listener on the list container and re-render immediately. Also update the auto-select fallback so a hidden (collapsed) item isn't picked as the default selection on page load.