mapbox / mapbox/mapbox-gl-js

Missing sourcedata event after sourcedataloading events

Open
#10,135 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation :mag:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 1.13.0

**browser**: Firefox

### Steps to Trigger Behavior

Flick the map some distance away to trigger a `sourcedataloading` event, then quickly flick it back to the start.
Although the `sourcedataloading` event has fired, no `sourcedata` event follows. The flick has to be sort of fast, though it seems to depend on network speed.

### Link to Demonstration

jsfiddle: https://jsfiddle.net/o6da71nq/
gif demonstration: https://drive.google.com/file/d/1EBQbggpFSHTlWx1swHqxkBeAhL7dGT42/view?usp=sharing

### Expected Behavior

A `sourcedata` (or `error`) event should follow the `sourcedataloading` event(s), as described in `sourcedataloading`'s spec:
>Fired when one of the map's sources begins loading or changing asyncronously. *All sourcedataloading events are followed by a sourcedata or error event.*

### Actual Behavior

Neither a `sourcedata` nor `error` event is fired after the `sourcedataloading` event(s)

### Potential Workaround

For any other users experiencing this, one workaround seems to be to listen to the `idle` event as a backup. If the `idle` event fires while you are expecting a `sourcedata` event, you can fallback to some behavior.

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

Reproduce the sequence in the linked jsfiddle: move the map to trigger sourcedataloading, then quickly return to the starting position. Trace the sourcedataloading, sourcedata, and error event handling; done means every sourcedataloading event is followed by sourcedata or error, including during rapid movement.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.