CartoDB / carto-vl

CARTO VL: a Javascript library to create vector-based visualizations
BSD 3-Clause "New" or "Revised" License
129 stars 26 forks source link

Cancellation of Layer._checkSourceRequestsAndFireEvents at new Requests #1424

Open kursat opened 4 years ago

kursat commented 4 years ago

Whats the problem We are trying to put a loader to our map component while there is ongoing tile requests. When we call maps flyTo function from outside of the component (we have to), new requests are sent, but layers loaded event is fired before responses of new requests.

How to reproduce problem

How we fixed the problem We have changed async function called from Layer._checkSourceRequestsAndFireEvents (TileClient._getTiles) to a cancelable-promise. At every call to _checkSourceRequestsAndFireEvents we cancelled that promise in order not to execute then block.