updates on the changes on warning and lat and long fixed to make it good
This commit is contained in:
@@ -145,10 +145,25 @@ export const standardizePlace = ({
|
||||
longitude: Number.isFinite(lngNum) ? lngNum : null,
|
||||
provider,
|
||||
raw,
|
||||
// Google-Maps-shaped accessors, for the call sites that still read a place
|
||||
// the way the Places API returned one.
|
||||
//
|
||||
// These return null — not 0 — when there is no coordinate, and that is a
|
||||
// fix rather than a style choice. Returning 0 made this object contradict
|
||||
// itself: `.latitude` above says null while `.geometry.location.lat()`
|
||||
// said 0, so which answer a caller got depended on which spelling it
|
||||
// happened to read. MultipleOrders read the accessor, so a suggestion with
|
||||
// no coordinates became a drop pinned at (0, 0); the pre-submit guard
|
||||
// tested `== null` and waved it through; the distance calculation then
|
||||
// routed Coimbatore to the Gulf of Guinea, fell back to Haversine, and
|
||||
// billed roughly 11,000 km — a number the backend honours verbatim
|
||||
// because the console sent it as `finalprice`.
|
||||
//
|
||||
// null propagates as "no pin", which every guard already handles.
|
||||
geometry: {
|
||||
location: {
|
||||
lat: () => (Number.isFinite(latNum) ? latNum : 0),
|
||||
lng: () => (Number.isFinite(lngNum) ? lngNum : 0)
|
||||
lat: () => (Number.isFinite(latNum) && latNum !== 0 ? latNum : null),
|
||||
lng: () => (Number.isFinite(lngNum) && lngNum !== 0 ? lngNum : null)
|
||||
}
|
||||
},
|
||||
address_components: [
|
||||
|
||||
Reference in New Issue
Block a user