From 281da6efd334c4909e68da5496f1af4cd3c07fad Mon Sep 17 00:00:00 2001 From: tharunreddy08 Date: Sun, 27 Sep 2026 10:56:38 +0530 Subject: [PATCH] fix: handle zero saved coordinates --- src/components/NearbyComplaints.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/NearbyComplaints.jsx b/src/components/NearbyComplaints.jsx index c1ec8f3..1e776dc 100644 --- a/src/components/NearbyComplaints.jsx +++ b/src/components/NearbyComplaints.jsx @@ -49,8 +49,10 @@ const NearbyComplaints = () => { } }; + const hasCoordinate = (value) => value !== null && value !== undefined && value !== ''; + const handleUseSavedLocation = async () => { - if (!user?.latitude || !user?.longitude) return; + if (!hasCoordinate(user?.latitude) || !hasCoordinate(user?.longitude)) return; await fetchNearby(user.latitude, user.longitude); }; @@ -94,7 +96,7 @@ const NearbyComplaints = () => { ); }; - const savedAvailable = Boolean(user?.latitude && user?.longitude); + const savedAvailable = hasCoordinate(user?.latitude) && hasCoordinate(user?.longitude); return (