Skip to content

Commit 9f77d3c

Browse files
BirdInTheTreeclaude
andcommitted
Fix tab-switch trap: render after navigation, not before
_setTab called _renderCurrentView before showScreen. If the renderer threw on partial/post-failure data, showScreen never ran and the user got stuck on whatever screen they were on — the click on Grid/Analytics looked dead. Switch the screen first; wrap render in try/catch so an empty or broken view does not block navigation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5d18599 commit 9f77d3c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/tvplot/html/parts/app.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,15 @@ function _setTab(tab) {
273273
if (btnGrid) btnGrid.classList.toggle('btn-nav-active', tab === 'grid');
274274
if (btnAnalytics) btnAnalytics.classList.toggle('btn-nav-active', tab === 'analytics');
275275

276-
_renderCurrentView();
276+
// Switch screen first so navigation always succeeds even if the renderer
277+
// throws on partial/post-failure data — otherwise the user gets trapped on
278+
// whatever screen they were on (the click looks dead).
277279
showScreen(tab === 'grid' ? 'grid' : 'analytics');
280+
try {
281+
_renderCurrentView();
282+
} catch (e) {
283+
console.error('Render failed in _setTab:', e);
284+
}
278285
}
279286

280287
// --- JSON import (file input + drag & drop) ---

0 commit comments

Comments
 (0)