[fix](trx-frontend-http): preserve location city name across freq changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-21 21:04:52 +01:00
parent e2e1aaebe2
commit 013badd081
@@ -2662,9 +2662,11 @@ function render(update) {
if (typeof update.ais_vessel_url_base === "string" && update.ais_vessel_url_base.length > 0) { if (typeof update.ais_vessel_url_base === "string" && update.ais_vessel_url_base.length > 0) {
aisVesselUrlBase = update.ais_vessel_url_base; aisVesselUrlBase = update.ais_vessel_url_base;
} }
const prevLat = serverLat, prevLon = serverLon;
if (update.server_latitude != null) serverLat = update.server_latitude; if (update.server_latitude != null) serverLat = update.server_latitude;
if (update.server_longitude != null) serverLon = update.server_longitude; if (update.server_longitude != null) serverLon = update.server_longitude;
if (locationSubtitle && Number.isFinite(serverLat) && Number.isFinite(serverLon)) { if (locationSubtitle && Number.isFinite(serverLat) && Number.isFinite(serverLon)
&& (serverLat !== prevLat || serverLon !== prevLon || !locationSubtitle.textContent)) {
const grid = latLonToMaidenhead(serverLat, serverLon); const grid = latLonToMaidenhead(serverLat, serverLon);
locationSubtitle.textContent = `Location: ${grid}`; locationSubtitle.textContent = `Location: ${grid}`;
locationSubtitle.style.display = ""; locationSubtitle.style.display = "";