There appears to be a cross-cutting bug where valid coordinates on the equator (lat = 0) or prime meridian (lon = 0) are treated as absent because the code uses JavaScript truthiness checks instead of explicit null/number checks.
As a result, legitimate locations such as:
can fail in multiple parts of the app.
Root cause
Several code paths use patterns like:
or:
if (!location?.lat || !location?.lon) return;
Since 0 is falsy in JavaScript, these checks reject valid coordinates.
Examples found
src/hooks/app/useDXLocation.js
if (parsed.lat && parsed.lon) return parsed;
src/hooks/useWeather.js
if (!location?.lat || !location?.lon) return;
src/components/SettingsPanel.jsx
if (lat && lon) {
const grid = calculateGridSquare(lat, lon);
setGridSquare(grid);
setConfigLocator(grid);
}
src/App.jsx
return wsjtx.decodes.filter((d) => d.lat && d.lon && d.timestamp >= ageCutoff);
src/DockableApp.jsx
if (spot.lat && spot.lon) {
handleDXChange({ lat: spot.lat, lon: spot.lon });
}
src/layouts/ModernLayout.jsx
if (r.lat && r.lon) handleDXChange({ lat: r.lat, lon: r.lon });
src/components/PSKReporterPanel.jsx
cursor: report.lat && report.lon ? 'pointer' : 'default',
Likely user-visible effects
Depending on which code path is hit, valid zero-valued coordinates may:
- fail to restore from saved DX location
- prevent weather from loading
- prevent locator/grid recalculation
- make spots/reports/decodes non-clickable
- prevent DX target updates
- cause inconsistent UI behavior for valid map/report positions on the equator or prime meridian
Expected behavior
Latitude 0 and longitude 0 should be treated as valid numeric coordinates everywhere.
Actual behavior
Any logic using truthiness treats 0 as missing, causing valid coordinates to be ignored.
Suggested fix
Replace truthiness checks with explicit coordinate validation, for example:
lat != null && lon != null
or, where numeric validation is appropriate:
Number.isFinite(lat) && Number.isFinite(lon)
This seems to affect multiple files, so it may be worth doing a repo-wide audit for patterns such as:
if (lat && lon)
if (!lat || !lon)
if (location?.lat && location?.lon)
if (!location?.lat || !location?.lon)
There appears to be a cross-cutting bug where valid coordinates on the equator (
lat = 0) or prime meridian (lon = 0) are treated as absent because the code uses JavaScript truthiness checks instead of explicit null/number checks.As a result, legitimate locations such as:
0, 1010, 00, 0can fail in multiple parts of the app.
Root cause
Several code paths use patterns like:
or:
Since
0is falsy in JavaScript, these checks reject valid coordinates.Examples found
src/hooks/app/useDXLocation.jssrc/hooks/useWeather.jssrc/components/SettingsPanel.jsxsrc/App.jsxsrc/DockableApp.jsxsrc/layouts/ModernLayout.jsxsrc/components/PSKReporterPanel.jsxLikely user-visible effects
Depending on which code path is hit, valid zero-valued coordinates may:
Expected behavior
Latitude
0and longitude0should be treated as valid numeric coordinates everywhere.Actual behavior
Any logic using truthiness treats
0as missing, causing valid coordinates to be ignored.Suggested fix
Replace truthiness checks with explicit coordinate validation, for example:
or, where numeric validation is appropriate:
This seems to affect multiple files, so it may be worth doing a repo-wide audit for patterns such as:
if (lat && lon)if (!lat || !lon)if (location?.lat && location?.lon)if (!location?.lat || !location?.lon)