rviscomi/red-dwarf

Map drawn before all locations geocoded

rviscomi opened this issue · 0 comments

The timedChunk utility function invokes a callback method when all items have been iterated over. The problem is that the process function that operates on each iteration may make its own asynchronous requests. So the async result may come back after the callback function is invoked.

In this case, the map is drawn before all locations are geocoded.

Do not rely on the callback function to draw the map. Keep track of the number of locations geocoded so far and invoke the map-drawing function when all locations have been processed.