fix(control-plane): restore accepted view after render failure

Preserve contributor history and current-main behavior while resolving the exact reviewed follow-up.

Source-PR: https://github.com/affaan-m/ECC/pull/3243
Source-Parent: cfe6d90d9f
Review-Manifest-SHA256: 78e13c4fe9581ef82100bb721f9b80ab8e62a15371e89b5f32c42c593944552b
This commit is contained in:
affaan-m
2026-09-28 00:55:09 -04:00
parent cfe6d90d9f
commit 2edb1de269
2 changed files with 57 additions and 2 deletions
@@ -281,8 +281,23 @@ function renderControlPlaneViewHtml() {
!Number.isFinite(data.thresholds.ta) || !Number.isFinite(data.thresholds.ra)) {
throw new Error('Invalid control-plane view');
}
var previous = view;
var drawStarted = false;
view = Object.assign({}, data);
renderEvents(); renderLanes(); draw();
try {
renderEvents(); renderLanes();
drawStarted = true;
draw();
} catch (error) {
view = previous;
try {
renderEvents(); renderLanes();
if (drawStarted) draw();
} catch (_) {
// Keep the accepted model even if the DOM cannot be restored.
}
throw error;
}
var c = view.counts || {};
var summary = (c.tasks || 0) + ' tasks in ' + (c.lanes || 0) + ' lanes, ' +
(c.advisories || 0) + ' advisories, ' + (c.resolutions || 0) + ' steering. ' +