mapbox / mapbox/mapbox-gl-js

Missing follow-up event for 'sourcedataloading' event

Open
#6,314 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 0.44.1

### Steps to Trigger Behavior

1. Open https://jsfiddle.net/Scarysize/2nq2v2an/3/ and open browser console
2. Watch for `start loading: source-x` logs
3. Watch for `done loading: source-x` logs
4. Additionally I'm logging `isSourceLoaded()` results every 3 seconds

### Expected Behavior

For every `(source-)dataloading` event of a given source, there should be a `(source-)data` event with `isSourceLoaded: true`.

The documentation states:

> All sourcedataloading events are followed by a sourcedata or error event.

### Actual Behavior

The `sourcedata` event is only dispatched for one of the four souces in the example.

EDIT: If I manually check if the sources are loaded (map.isSourceLoaded(...)) the expected value is returned. I'm just missing the event.

### Context

We are trying to incrementally add source & layer pairs. So when one source-layer-combination is done "loading", we would like to add the next pair. Basically buffering future sources.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked JSFiddle reproduction and the sourcedataloading, sourcedata, and error event behavior described in the issue. Compare those events with repeated map.isSourceLoaded() checks; done means each relevant loading event has the documented follow-up event or an error, including the multiple-source case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.