mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
fix(client): settle the two findings Sonar raised on the audit branch
The farthest-stop reduce gets its explicit seed (the guard above already refuses an empty list, the seed makes that local), and the toast pill moves into its own component so the host stays below the complexity ceiling.
This commit is contained in:
@@ -95,7 +95,7 @@ export const getAccommodationAnchors = (
|
||||
const farthestFrom = (h: Accommodation): EdgeStop | undefined => {
|
||||
if (!stops?.length) return undefined
|
||||
const from = at(h)
|
||||
const far = stops.reduce((a, b) => (haversineKm(from, b) > haversineKm(from, a) ? b : a))
|
||||
const far = stops.reduce((a, b) => (haversineKm(from, b) > haversineKm(from, a) ? b : a), stops[0])
|
||||
return { isPlace: true, time: null, lat: far.lat, lng: far.lng }
|
||||
}
|
||||
const hasStops = !!stops?.length
|
||||
|
||||
Reference in New Issue
Block a user