mapbox / mapbox/mapbox-gl-js

An error occurs when removing a source immediately after removing a layer, in 3d terrain mode

Open
#12,747 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**mapbox-gl-js version**: 2.15.0

**browser**: Version 114.0.5735.106 (Official Build) (arm64)

### Steps to Trigger Behavior

1. add 3d terrain
2. add source
3. add layer
4. remove layer
5. remove source

### Workaround

- async code
- `await map.once('idle')` before removing source

### Link to Demonstration

https://jsfiddle.net/fxi/fe1orp8y/

### Expected Behavior

no error

### Actual Behavior

`Error: Cannot read properties of undefined (reading 'get')`

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 and reproduce the sequence in 3D terrain mode: remove a layer and then its source immediately. Trace the terrain, layer, and source removal lifecycle to identify why the immediate operation reads from undefined; done means the sequence completes without an error, without requiring the idle workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.