Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions app/ui/src/app/results/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,19 @@ function buildRoutePath(
}
return { lat: s.lat, lng: s.lng };
});
if (route.startLocation) {
return [
{ lat: route.startLocation.lat, lng: route.startLocation.lng },
...deliveryPoints,
];
const points = route.startLocation
? [
{ lat: route.startLocation.lat, lng: route.startLocation.lng },
...deliveryPoints,
]
: deliveryPoints;
// Close the loop so the map shows the drive back home: the last stop connects
// to the starting point (depot, or the first stop when no depot is provided),
// even though the optimizer output does not include the return leg.
if (points.length >= 2) {
points.push({ ...points[0]! });
}
return deliveryPoints;
return points;
}

function RoutePolylinesOverlay({
Expand Down
Loading