Skip to content

Commit da92f60

Browse files
authored
Merge pull request #174 from OpenSourceFellows/issue-173-fix-layer-toggle-ghost-markers
Fix layer toggle bug causing ghost markers to persist
2 parents 7f535db + 2894f3b commit da92f60

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ function App() {
2626

2727
// Take the name property of each collection and set it's initial visibility to true
2828
const layerNames = collections.map((fc) => fc.name )
29-
const visbilityMap = layerNames.reduce((map, name) => { map[name] = true; return map }, {} as LayerVisibilityMap)
30-
setLayerVisibility({...visbilityMap})
29+
const visibilityMap = layerNames.reduce((map, name) => { map[name] = true; return map }, {} as LayerVisibilityMap)
30+
setLayerVisibility({...visibilityMap})
3131
},)
3232
}, [])
3333

3434
const layersToRender = layers.filter((fc) => layerVisibility[fc.name])
35-
console.log(layersToRender)
3635

3736
return (
3837
<div className="app-container">

src/components/Map/Layer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ interface LayerProps {
1111
export const Layer: React.FC<LayerProps> = ({ featureCollection }) => {
1212
return (
1313
featureCollection.features.map((feature, idx) => (
14-
<GeoJSON key={idx} data={feature}/>
14+
<GeoJSON
15+
key={`${featureCollection.name}-${feature.id || idx}`}
16+
data={feature}
17+
/>
1518
))
1619
)
1720
}

0 commit comments

Comments
 (0)