On 'load' and on 'loading' events don't trigger for the returned cartolayer.
See original GitHub issueContext
Hi,
I’m not sure if this has been posted before, I’m unable to find another mentioning this.
This is for Cartojs 3.15.17 so far only reproducible on Chrome
Creating a layer works as intended. We have a listener for the returned layer, namely;
on ‘loading’ and on ‘load’. There is a very small chance that these do no trigger. This happens more often the more requests are made for tiles from Carto.com.
Say you have a map to view your dataset
cartodb.createLayer(map, {
user_name: carto_username,
type: 'cartodb',
sublayers: sublayers
}, {
https: true
})
.addTo(map, 1)
.on('done', function (cartolayer) { //layer created on index 1
cartolayer.on('loading', function () {
gifLoad() //showloading gif
});
cartolayer.on('load', function () {
gifUnLoad() //hideloading gif
})
})
})
The goal here is to request the tiles, drop them on the map. When new tiles are requested, show a loading gif, if the tiles are done, hide the gif.
However moving the map continuously would sometimes stop the ‘load’ and ‘loading’ events from triggering.
Steps to Reproduce
Please break down here below all the needed steps to reproduce the issue
- Add Carto.js 3.15.17 on a base map.
- Request a data set
- Add ‘load’ and ‘loading’ events on the layer.
4. Move the map frequently until the listeners stop triggering. - Move around to request new tiles, while new tiles are being retrieved zoom in and out.
Current Result
The listeners stopped triggering.
Expected result
The listeners trigger as normal
Browser and version
Chrome Version 67.0.3396.87 (Official Build) (64-bit) Microsoft Edge 42.17134.1.0 - Microsoft EdgeHTML 17.17134
Additional info
Hiding and then showing the returned layer fixes the issue.
cartolayer.getSubLayer(index).hide()
cartolayer.getSubLayer(index).show()
Edit: Confirmed also on Edge
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Shipped! 🚀
I’ll publish the fix then on the official release.
Thanks!