Working filters with added check to make sure empty locations dont create clusters

This commit is contained in:
efarooqui
2020-10-07 10:19:03 -07:00
parent c86c4fba02
commit 3dc13f334b
2 changed files with 8 additions and 2 deletions

View File

@@ -181,7 +181,11 @@ export function isLongitude (lng) {
}
export function mapClustersToLocations (clusters, locations) {
return clusters.map(cl => locations.find(location => location.label === cl.properties.id))
return clusters.reduce((acc, cl) => {
const foundLocation = locations.find(location => location.label === cl.properties.id)
if (foundLocation) acc.push(foundLocation)
return acc
}, [])
}
export const dateMin = function () {