Add defensive checks for is_most_recent_for_callsign property

Improves robustness by adding fallback logic when is_most_recent_for_callsign
is undefined or null. In edge cases where this server-side property might not
be reliably set, falls back to the previous behavior of excluding historical
markers using the _isHistorical flag.

Changes:
- Added explicit boolean checks for is_most_recent_for_callsign === true
- Added fallback logic: if property is null/undefined, use \!_isHistorical
- Applied to both addMarker() and zoom handler functions
- Ensures spidering works even if server-side property is inconsistent

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2025-07-29 12:00:49 -05:00
parent 8848c5b391
commit 850498c50b
No known key found for this signature in database

View file

@ -505,7 +505,10 @@ let MapAPRSMap = {
self.markers.forEach((marker, id) => {
const markerState = self.markerStates.get(String(id));
// Only add most recent markers (those with icons) to OMS for spidering
if (marker && !marker._isClusterMarker && markerState && markerState.is_most_recent_for_callsign) {
// Fallback: if is_most_recent_for_callsign is undefined, exclude historical markers as before
const shouldAddToOms = markerState?.is_most_recent_for_callsign === true ||
(markerState?.is_most_recent_for_callsign == null && !marker._isHistorical);
if (marker && !marker._isClusterMarker && markerState && shouldAddToOms) {
self.oms.addMarker(marker);
}
});
@ -1550,7 +1553,10 @@ let MapAPRSMap = {
}
// Add to OMS for overlapping marker handling (only most recent packets with icons)
if (self.oms && marker && self.map && !marker._isClusterMarker && data.is_most_recent_for_callsign) {
// Fallback: if is_most_recent_for_callsign is undefined, exclude historical markers as before
const shouldAddToOms = data.is_most_recent_for_callsign === true ||
(data.is_most_recent_for_callsign == null && !(marker as APRSMarker)._isHistorical);
if (self.oms && marker && self.map && !marker._isClusterMarker && shouldAddToOms) {
self.oms.addMarker(marker);
}
},