Repository navigation
fix: handle zero saved coordinates - #67
tharunreddy08 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Non-numeric and non-finite coordinates are still accepted.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes saved-location handling so valid coordinates of 0 are accepted.
Changes:
- Updates coordinate validation.
- Applies validation to saved-location visibility and handling.
- Still requires rejection of non-numeric coordinate values.
| File | Description |
|---|---|
src/components/NearbyComplaints.jsx |
Updates saved-coordinate validation and usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| }; | ||
|
|
||
| const hasCoordinate = (value) => value !== null && value !== undefined && value !== ''; |
|
@tharunreddy08 This fixes 0 coordinates, but #41 also requires non-numeric coordinates to be rejected. hasCoordinate only checks for null/undefined/empty string, so values like NaN, Infinity, or not-a-number still show the saved-location button and get passed to the nearby request. Please reject blank values and use Number.isFinite(Number(value)) for both latitude and longitude, while keeping 0 valid. Apply the same check to the button and click handler. |
|
This accepts 0 coordinates, but hasCoordinate still accepts NaN, Infinity, and non-numeric text. Please reject invalid or blank values in both the saved-location button check and the click handler, while keeping 0 valid. This overlaps with #80's updated coordinate fix, so please reconcile the two branches. |
|
@tharunreddy08 The coordinate check still lets non-numeric values such as NaN and Infinity through, so #41 and the earlier review aren't fully addressed. Please validate finite numeric values in both the button and click handler while keeping 0 valid. #87 now covers this same fix, so please reconcile or close the duplicate PR. |
|
@tharunreddy08 Thanks for this. The same change already landed in #87, so this one is now obsolete. Closing it. Appreciate the contribution! |

Summary
Fixes #41 — Saved location is ignored when latitude or longitude is
0.Changes
0as a missing value.0, 0are accepted.Testing
Closes #41