diff --git a/public/app.js b/public/app.js index 2dcade8..1478d7b 100644 --- a/public/app.js +++ b/public/app.js @@ -89,6 +89,7 @@ document.addEventListener('DOMContentLoaded', function() { // ── Robot.json + History ───────────────────────────────────────────────── let robotJsonActive = 'current'; + let robotJsonLastSerialized = null; function renderJsonTree(data, container) { container.innerHTML = ''; @@ -123,9 +124,13 @@ document.addEventListener('DOMContentLoaded', function() { fetch(url) .then(res => res.ok ? res.json() : Promise.reject(res.status)) .then(data => { + const serialized = JSON.stringify(data); document.getElementById('robotJsonLabel').textContent = robotJsonActive === 'current' ? '(aktuell)' : `(${robotJsonActive})`; - renderJsonTree(data, document.getElementById('robotJsonTree')); + if (serialized !== robotJsonLastSerialized) { + robotJsonLastSerialized = serialized; + renderJsonTree(data, document.getElementById('robotJsonTree')); + } }) .catch(err => { document.getElementById('robotJsonTree').textContent = `Fehler: ${err}`; @@ -134,6 +139,7 @@ document.addEventListener('DOMContentLoaded', function() { function setHistoryActive(ts) { robotJsonActive = ts; + robotJsonLastSerialized = null; // Neuaufbau erzwingen beim Snapshot-Wechsel updateRobotJson(); document.querySelectorAll('#robotHistoryList li').forEach(l => { l.classList.toggle('rh-active', l.dataset.ts === ts);