Fix: delay popup open after setView, add debug logging

Leaflet needs map to settle after setView before popup can open.
Added 500ms delay + console.warn if target marker not found.
This commit is contained in:
you committed 2026-03-22 23:01:18 +00:00
1 parent 46868b7dcd
commit f0243ff332
2 files changed
+13 -6

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@
<script src="app.js?v=1774126708"></script>
<script src="home.js?v=1774042199"></script>
<script src="packets.js?v=1774220409"></script>
<script src="map.js?v=1774220146" onerror="console.error('Failed to load:', this.src)"></script>
<script src="map.js?v=1774220478" onerror="console.error('Failed to load:', this.src)"></script>
<script src="channels.js?v=1774331200" onerror="console.error('Failed to load:', this.src)"></script>
<script src="nodes.js?v=1774218049" onerror="console.error('Failed to load:', this.src)"></script>
<script src="traces.js?v=1774135052" onerror="console.error('Failed to load:', this.src)"></script>
+12 -5
View File
@@ -384,11 +384,18 @@
const targetNode = nodes.find(n => n.public_key === targetNodeKey);
if (targetNode && targetNode.lat && targetNode.lon) {
map.setView([targetNode.lat, targetNode.lon], 14);
markerLayer.eachLayer(m => {
if (m._nodeKey === targetNodeKey && m.openPopup) {
m.openPopup();
}
});
// Delay popup open slightly — Leaflet needs the map to settle after setView
setTimeout(() => {
let found = false;
markerLayer.eachLayer(m => {
if (found) return;
if (m._nodeKey === targetNodeKey && m.openPopup) {
m.openPopup();
found = true;
}
});
if (!found) console.warn('[map] Target node marker not found:', targetNodeKey);
}, 500);
}
}