question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On 'load' and on 'loading' events don't trigger for the returned cartolayer.

See original GitHub issue

Context

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

  1. Add Carto.js 3.15.17 on a base map.
  2. Request a data set
  3. Add ‘load’ and ‘loading’ events on the layer. 4. Move the map frequently until the listeners stop triggering.
  4. 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ivanmalagoncommented, Jul 9, 2018

Shipped! 🚀

0reactions
ivanmalagoncommented, Jul 5, 2018

I’ll publish the fix then on the official release.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

onload event doesn't trigger in chrome until after I click " ...
The function is triggered by onload event on the tag. I have loaded this page on apache web server installed with XAMPP. When...
Read more >
Properties - deck.gl
Deck is a class that takes deck.gl layer instances and viewport parameters, renders those layers as a transparent overlay, and handles events.
Read more >
Manually Triggering the Loading of Events - Hevo Data
This internally schedules a task and starts loading the Events to the Destination.
Read more >
deck.gl
... Do not trigger transition on viewport size change; Do not compare viewports if there's no ... FIX: IconLayer does not rerender after...
Read more >
PDF - Introduction to Web Mapping
The book assumes no background knowledge in programming or web technologies ... The image should now be loaded from a remote location—the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found