fix: null-guard all animation entry points (pulseNode, animatePath, drawAnimatedLine)

All animation functions now bail early if animLayer/pathsLayer are null,
preventing cascading errors from setInterval callbacks after navigation.
This commit is contained in:
you
2026-03-22 05:08:06 +00:00
parent 9d6707f410
commit bd08d91fc1
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -90,7 +90,7 @@
<script src="nodes.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
<script src="traces.js?v=1774135052" onerror="console.error('Failed to load:', this.src)"></script>
<script src="analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
<script src="live.js?v=1774155165" onerror="console.error('Failed to load:', this.src)"></script>
<script src="live.js?v=1774156086" onerror="console.error('Failed to load:', this.src)"></script>
<script src="observers.js?v=1774290000" onerror="console.error('Failed to load:', this.src)"></script>
<script src="observer-detail.js?v=1774028201" onerror="console.error('Failed to load:', this.src)"></script>
<script src="node-analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
+3
View File
@@ -1555,6 +1555,7 @@
}
function animatePath(hopPositions, typeName, color) {
if (!animLayer || !pathsLayer) return;
activeAnims++;
document.getElementById('liveAnimCount').textContent = activeAnims;
let hopIndex = 0;
@@ -1600,6 +1601,7 @@
}
function pulseNode(key, pos, typeName) {
if (!animLayer || !nodesLayer) return;
if (!nodeMarkers[key]) {
const ghost = L.circleMarker(pos, {
radius: 5, fillColor: '#6b7280', fillOpacity: 0.3, color: '#fff', weight: 0.5, opacity: 0.2
@@ -1653,6 +1655,7 @@
}
function drawAnimatedLine(from, to, color, onComplete, overrideOpacity) {
if (!animLayer || !pathsLayer) { if (onComplete) onComplete(); return; }
const steps = 20;
const latStep = (to[0] - from[0]) / steps;
const lonStep = (to[1] - from[1]) / steps;