diff --git a/public/hop-resolver.js b/public/hop-resolver.js index 8be5ee91..8cad87f0 100644 --- a/public/hop-resolver.js +++ b/public/hop-resolver.js @@ -81,11 +81,8 @@ window.HopResolver = (function() { function resolve(hops, originLat, originLon, observerLat, observerLon, observerId) { if (!hops || !hops.length) return {}; - console.log('[HopResolver] resolve:', { hops, originLat, originLon, observerId, iataCoords: Object.keys(iataCoords).length, observers: Object.keys(observerIataMap).length }); - // Determine observer's IATA for regional filtering const packetIata = observerId ? observerIataMap[observerId] : null; - if (observerId) console.log('[HopResolver] observer:', observerId.slice(0,12), '→ IATA:', packetIata); const resolved = {}; const hopPositions = {}; diff --git a/public/index.html b/public/index.html index eefd55cc..af11d1fb 100644 --- a/public/index.html +++ b/public/index.html @@ -82,11 +82,11 @@ - + - + diff --git a/public/packets.js b/public/packets.js index 76d641ff..deb1d2bb 100644 --- a/public/packets.js +++ b/public/packets.js @@ -1100,14 +1100,17 @@ let pathHops; try { pathHops = JSON.parse(pkt.path_json || '[]'); } catch { pathHops = []; } - // Re-resolve hops with observer + sender location for regional filtering & disambiguation + // Re-resolve hops with sender location + observer — bypass stale cache if (pathHops.length) { await ensureHopResolver(); - const senderLat = (decoded.lat != null && decoded.lat !== 0) ? decoded.lat : (decoded.latitude || null); - const senderLon = (decoded.lon != null && decoded.lon !== 0) ? decoded.lon : (decoded.longitude || null); - console.log('[renderDetail] re-resolve:', { senderLat, senderLon, observer: pkt.observer_id?.slice(0,12), decodedKeys: Object.keys(decoded) }); - const resolved = HopResolver.resolve(pathHops, senderLat, senderLon, null, null, pkt.observer_id); - Object.assign(hopNameCache, resolved || {}); + const senderLat = decoded.lat != null ? decoded.lat : (decoded.latitude || null); + const senderLon = decoded.lon != null ? decoded.lon : (decoded.longitude || null); + // Always re-resolve for detail view — list view may have cached without anchor + const fresh = HopResolver.resolve(pathHops, senderLat, senderLon, null, null, pkt.observer_id); + // Overwrite cache with better results + for (const [k, v] of Object.entries(fresh || {})) { + hopNameCache[k] = v; + } } // Parse hash size from path byte