Skip to content

Commit

Permalink
Merge pull request #165 from forensic-architecture/feature/superclust…
Browse files Browse the repository at this point in the history
…er-corners

Feature/supercluster corners
  • Loading branch information
ebefarooqui authored Oct 21, 2020
2 parents 7d8afaa + 72f2582 commit f8e566e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/components/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ class Map extends React.Component {
}
}

componentDidUpdate (prevState, prevProps) {
// HACK: this is required because of something to do with Leaflet and the
// React lifecycle not playing nice... if you don't put this conditional,
// then the map sometimes appear blank on first load.
if (this.props.domain.locations.length > 0 && this.state.clusters.length === 0) {
this.loadClusterData(this.props.domain.locations)
}
}

initializeMap () {
/**
* Creates a Leaflet map and a tilelayer for the map background
Expand Down Expand Up @@ -175,8 +166,9 @@ class Map extends React.Component {
return acc
}, [])
this.superclusterIndex.load(convertedLocations)
this.setState({ indexLoaded: true })
this.updateClusters()
this.setState({ indexLoaded: true }, () => {
this.updateClusters()
})
} else {
this.setState({ clusters: [] })
}
Expand Down

0 comments on commit f8e566e

Please sign in to comment.