Skip to content

Commit 7019f41

Browse files
author
David Emory
committed
fix(map): Fix bug with display of partially-loaded route geometry overlays
1 parent 041c939 commit 7019f41

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

lib/components/map/route-viewer-overlay.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,24 @@ class RouteViewerOverlay extends MapLayer {
5050
if (!routeData || !routeData.patterns) return <FeatureGroup />
5151

5252
const routeColor = routeData.color ? `#${routeData.color}` : '#00bfff'
53-
return (
54-
<FeatureGroup>
55-
{Object.values(routeData.patterns).map(pattern => {
56-
if (!pattern.geometry) return null
57-
const pts = polyline.decode(pattern.geometry.points)
58-
return (
59-
<Polyline
60-
positions={pts}
61-
weight={4}
62-
color={routeColor}
63-
opacity={1}
64-
key={pattern.id}
65-
/>
66-
)
67-
})}
68-
</FeatureGroup>
69-
)
53+
const segments = []
54+
Object.values(routeData.patterns).forEach(pattern => {
55+
if (!pattern.geometry) return
56+
const pts = polyline.decode(pattern.geometry.points)
57+
segments.push(
58+
<Polyline
59+
positions={pts}
60+
weight={4}
61+
color={routeColor}
62+
opacity={1}
63+
key={pattern.id}
64+
/>
65+
)
66+
})
67+
68+
return segments.length > 0
69+
? <FeatureGroup><div>{segments}</div></FeatureGroup>
70+
: <FeatureGroup />
7071
}
7172
}
7273

0 commit comments

Comments
 (0)