Skip to content

Commit

Permalink
Fixed randomly not loading data.json-embedded KMLs
Browse files Browse the repository at this point in the history
Changed the asychronicity code for loading KMLs embedded into data.json
to avoid race conditions that did not let the KML to load on screen.
  • Loading branch information
Sp3EdeR committed Jun 3, 2024
1 parent 0c96272 commit fbe3e04
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions res/huroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,7 @@ function addRoute(data)
omnivore.kml(data.kml, null, layer).addTo(map);
else
// The 0-timeout runs the function asynchronously
tmout = setTimeout(() => {
omnivore.kml.parse(data.kml, null, layer).addTo(map);
clearTimeout(tmout);
}, 0);
setTimeout(() => omnivore.kml.parse(data.kml, null, layer).addTo(map));
return routeId;
}

Expand Down

0 comments on commit fbe3e04

Please sign in to comment.