mapbox / mapbox/mapbox-gl-js

Updating style leads to error "undefined (reading 'get')"

Open
#11,820 1 comment 7 reactions 0 assignees View on GitHub
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.82

**browser**: latest Chrome or Safari, happens on both

### Steps to Trigger Behavior

1. Click button in top left in code sandbox. Simulates update to style that causes the crash.

### Link to Demonstration

https://codesandbox.io/s/proud-wave-gohost

### Expected Behavior

Should not crash. This version doesn't do much but it crashes specifically with a symbol layer (I've found no other types of layers to be an issue).

### Actual Behavior

```
new LayerPlacement
../src/style/pauseable_placement.js:23:50
20 | _bucketParts: Array;
21 |
22 | constructor(styleLayer: SymbolStyleLayer) {
> 23 | this._sortAcrossTiles = styleLayer.layout.get('symbol-z-order') !== 'viewport-y' &&
| ^
24 | styleLayer.layout.get('symbol-sort-key').constantOr(1) !== undefined;
25 |
26 | this._currentTileIndex = 0;
```

Contributor guide

Open the contributing guide

Research direction

Start with the CodeSandbox reproduction and then read src/style/pauseable_placement.js around the LayerPlacement constructor, especially the symbol layer layout access. Confirm the crash when updating the style with a symbol layer, and consider the issue resolved when that update no longer crashes in the reported browsers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
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.