fix(ui): no-cache static assets (stop stale CSS/JS after deploys); live nav-active sync; breadcrumb sized+themed to match back button
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,15 @@ export function renderSidebar(root) {
|
||||
)
|
||||
);
|
||||
|
||||
renderSpaceTree(spacesContainer);
|
||||
// Sync the active highlight across ALL nav items (global links + space tree)
|
||||
// to the current hash. navItem only sets active at creation, so without this
|
||||
// the highlight stays stuck on the previously-selected tab until a refresh.
|
||||
function syncActive() {
|
||||
root.querySelectorAll('a.sb-item').forEach(a =>
|
||||
a.classList.toggle('active', a.getAttribute('href') === location.hash));
|
||||
}
|
||||
|
||||
renderSpaceTree(spacesContainer).then(syncActive);
|
||||
|
||||
// Pending-count badge wiring
|
||||
on('pending-count', (n) => {
|
||||
@@ -110,6 +118,10 @@ export function renderSidebar(root) {
|
||||
if (n > 0) inboxItem.appendChild(el('span', { class: 'badge' }, String(n)));
|
||||
});
|
||||
|
||||
// Refresh tree on hashchange (active highlight) and on space creation.
|
||||
window.addEventListener('hashchange', () => renderSpaceTree(spacesContainer));
|
||||
// On navigation: re-render the tree (lazy state) then re-sync the highlight.
|
||||
window.addEventListener('hashchange', async () => {
|
||||
await renderSpaceTree(spacesContainer);
|
||||
syncActive();
|
||||
});
|
||||
syncActive();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user