fix render

This commit is contained in:
larssand
2026-03-22 17:49:19 +01:00
parent 5c96f2e421
commit e0237f7dad

View File

@@ -2861,6 +2861,7 @@ function renderView() {
themeLabel.textContent = t("ui.theme"); themeLabel.textContent = t("ui.theme");
} }
try {
switch (currentView) { switch (currentView) {
case "dashboard": case "dashboard":
renderDashboard(); renderDashboard();
@@ -2898,6 +2899,17 @@ function renderView() {
default: default:
renderDashboard(); renderDashboard();
} }
} catch (error) {
console.error("renderView failed", error);
dom.view.innerHTML = `
<section class="panel">
<div class="panel-header"><h3>Render error</h3></div>
<div class="panel-body">
<p>${escapeHtml(error instanceof Error ? error.message : String(error))}</p>
</div>
</section>
`;
}
updateHeaderState(); updateHeaderState();
} }
@@ -3202,8 +3214,8 @@ function handleSessionTimerTick() {
function renderDashboard() { function renderDashboard() {
const active = getActiveSession(); const active = getActiveSession();
const schedule = getScheduleDriftSummary(); const schedule = getScheduleDriftSummary();
const totalPassings = Object.values(state.resultsBySession).reduce( const totalPassings = Object.values(state.resultsBySession || {}).reduce(
(sum, x) => sum + (x.passings?.length || 0), (sum, x) => sum + (x?.passings?.length || 0),
0 0
); );
const backendUrl = getBackendUrl(); const backendUrl = getBackendUrl();