Filter out stations without location from map#1309
Conversation
✅ Deploy Preview for antenna-ssec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for antenna-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR enhances the deployments map to validate location data and guide users toward configuration. The minimum map zoom is increased, coordinate filtering prevents invalid markers from rendering, and a conditional tip with a configuration link appears when deployments lack locations but are editable. The summary and deployment-details-info components integrate these changes by passing the project ID and handling optional coordinates. ChangesDeployment map location validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/src/pages/deployment-details/deployment-details-info.tsx`:
- Line 99: The component currently uses truthy checks like
value={deployment.latitude ? `${deployment.latitude}` : undefined} which treats
valid 0 coordinates as missing; update these checks (for deployment.latitude and
the other coordinate fields at the same block/lines 103-105) to explicitly test
for null/undefined (e.g. deployment.latitude != null ? `${deployment.latitude}`
: undefined or use String(deployment.latitude) with a nullish coalescing
fallback) so that 0 is preserved and only null/undefined render as missing.
In `@ui/src/pages/project/summary/deployments-map.tsx`:
- Around line 21-27: The filter currently uses truthy OR and drops valid zero
coordinates and allows one-sided coordinates; update the filtering on the
deployments array to require both latitude and longitude be present by using an
AND check and null/undefined-safe comparisons (e.g., check deployment.latitude
!= null && deployment.longitude != null) so 0 values are preserved, then
construct MarkerPosition(deployment.latitude, deployment.longitude) as before;
apply the same change to the second occurrence around the block that builds
marker tips (the other filter at lines referencing deployments and
MarkerPosition).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0d89010c-21fd-4920-a9d3-18c6e02bfee6
📒 Files selected for processing (5)
ui/src/design-system/map/config.tsui/src/pages/deployment-details/deployment-details-info.tsxui/src/pages/project/summary/deployments-map.tsxui/src/pages/project/summary/summary.tsxui/src/utils/language.ts
| <InputValue | ||
| label={translate(STRING.FIELD_LABEL_LATITUDE)} | ||
| value={`${deployment.latitude}`} | ||
| value={deployment.latitude ? `${deployment.latitude}` : undefined} |
There was a problem hiding this comment.
Preserve 0 latitude/longitude when formatting values.
Line 99 and Lines 103-105 use truthy checks, so valid 0 coordinates are rendered as missing (n/a).
Proposed fix
- value={deployment.latitude ? `${deployment.latitude}` : undefined}
+ value={
+ deployment.latitude != null
+ ? `${deployment.latitude}`
+ : undefined
+ }
...
- value={
- deployment.longitude ? `${deployment.longitude}` : undefined
- }
+ value={
+ deployment.longitude != null
+ ? `${deployment.longitude}`
+ : undefined
+ }Also applies to: 103-105
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ui/src/pages/deployment-details/deployment-details-info.tsx` at line 99, The
component currently uses truthy checks like value={deployment.latitude ?
`${deployment.latitude}` : undefined} which treats valid 0 coordinates as
missing; update these checks (for deployment.latitude and the other coordinate
fields at the same block/lines 103-105) to explicitly test for null/undefined
(e.g. deployment.latitude != null ? `${deployment.latitude}` : undefined or use
String(deployment.latitude) with a nullish coalescing fallback) so that 0 is
preserved and only null/undefined render as missing.
| deployments | ||
| .filter((deployment) => deployment.latitude || deployment.longitude) | ||
| .map((deployment) => ({ | ||
| position: new MarkerPosition( | ||
| deployment.latitude, | ||
| deployment.longitude | ||
| ), |
There was a problem hiding this comment.
Fix coordinate filtering to require both coordinates and keep 0 values.
Line 22 currently uses truthy OR, which drops valid 0 lat/lng and still allows one-sided coordinates through. That can produce invalid markers and incorrect tip visibility.
Proposed fix
- deployments
- .filter((deployment) => deployment.latitude || deployment.longitude)
+ deployments
+ .filter(
+ (deployment) =>
+ deployment.latitude != null && deployment.longitude != null
+ )
.map((deployment) => ({Also applies to: 33-35
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ui/src/pages/project/summary/deployments-map.tsx` around lines 21 - 27, The
filter currently uses truthy OR and drops valid zero coordinates and allows
one-sided coordinates; update the filtering on the deployments array to require
both latitude and longitude be present by using an AND check and
null/undefined-safe comparisons (e.g., check deployment.latitude != null &&
deployment.longitude != null) so 0 values are preserved, then construct
MarkerPosition(deployment.latitude, deployment.longitude) as before; apply the
same change to the second occurrence around the block that builds marker tips
(the other filter at lines referencing deployments and MarkerPosition).

Summary
List of Changes
Detailed Description
Screenshots
Before:

After:

Summary by CodeRabbit
Release Notes
New Features
Improvements