Skip to content

Commit

Permalink
fix: cluster not found during async call #39
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Dec 2, 2024
1 parent 9d8e310 commit 50fb890
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/teritorio-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,13 @@ export class TeritorioCluster extends EventTarget {
// Get cluster's leaves
if (feature.properties.cluster) {
const source = this.map.getSource(this.sourceId) as GeoJSONSource
const leaves = await source.getClusterLeaves(Number.parseInt(id), feature.properties.point_count, 0) as MapGeoJSONFeature[]
this.clusterLeaves.set(id, leaves)
try {
// https://cartinfo.cocm.fr/content/api.teritorio/geodata/v0.1/cocm/tourism/pois/category/206.geojson?geometry_as=point&short_description=true
const leaves = await source.getClusterLeaves(Number.parseInt(id), feature.properties.point_count, 0) as MapGeoJSONFeature[]
this.clusterLeaves.set(id, leaves)
} catch(error) {

Check failure on line 350 in src/teritorio-cluster.ts

View workflow job for this annotation

GitHub Actions / 🛠️ Setup Development Environment

Closing curly brace appears on the same line as the subsequent block

Check failure on line 350 in src/teritorio-cluster.ts

View workflow job for this annotation

GitHub Actions / 🛠️ Setup Development Environment

Expected space(s) after "catch"
console.error(error)
}
}
}

Expand Down

0 comments on commit 50fb890

Please sign in to comment.