Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load and idle event never triggered when a source loading fails #5430

Open
oterral opened this issue Jan 30, 2025 · 3 comments
Open

load and idle event never triggered when a source loading fails #5430

oterral opened this issue Jan 30, 2025 · 3 comments
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@oterral
Copy link
Contributor

oterral commented Jan 30, 2025

It seems that when source fails to load that the load and idle event are never triggered.
I suppose that if tiles.json requests fails the map should just ignore them and triggers the events properly.

maplibre-gl-js version: 5

browser: all

Steps to Trigger Behavior

  1. Open https://codepen.io/oterral/pen/YPKgyGq
  2. An alert box should appear for the 'load' and 'idle' event but notthing happens

Link to Demonstration

Open https://codepen.io/oterral/pen/YPKgyGq

or try this:

// Initialise the map
const map = new maplibregl.Map({
  container: 'map',
  style: "https://vectortiles.geo.admin.ch/styles/ch.swisstopo.leichte-basiskarte_world.vt/style.json",
  center: [7, 47],
  zoom: 10
});

map.on('load',()=> alert("loadevent"));
map.on('idle',()=> alert("idleevent"));

Expected Behavior

idle and load events are triggered

Actual Behavior

idle and load events are not triggered

@HarelM
Copy link
Collaborator

HarelM commented Jan 30, 2025

Has this been changed in recent versions or is this the behavior since version 1.x or 2.x?

@HarelM HarelM added bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed labels Jan 30, 2025
@neodescis
Copy link
Collaborator

I believe this has been the behavior since 1.x. Do we think the load event should be published if loading fails? It does seem the idle event should be at least. There's also an error event that should be published; is that happening for you @oterral ?

@oterral
Copy link
Contributor Author

oterral commented Jan 31, 2025

@neodescis yes the error event is triggered. For sure if nothing happens on the map the 'idle' should be triggered . As a user that doesn't have the hand on the style I would also expect that 'load' event is triggered every time i load the map, whatever if a source loading have failed otherwise I can't rely on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants