mapbox / mapbox/mapbox-gl-js

setPaintProperty will request tiles again

Open
#13,575 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :lady_beetle: needs information :pray:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### mapbox-gl-js version

v3.8.0

### Browser and version

141.0.7390.65

### Expected behavior

Tiles are not requested again when running `setPaintProperty`

### Actual behavior

Tiles are requested again when running `setPaintProperty`

### Link to the demonstration

_No response_

### Steps to trigger the unexpected behavior

When i run `setPaintProperty` on our vector tiles (running on our own tileservice, created with tippicanou) than it request some tiles again.

its happen for example when i switch between this two styles.

```
map.setPaintProperty("cableLayer", "line-color", "red")
```

```
map.setPaintProperty("cableLayer", "line-color", [

"case",
[
"==",
[
"get",
"type"
]
,
"5"
],
"#686868",
"#686768"
]
)
```

but not when i run the same style again or this, without `get`
```
map.setPaintProperty("cableLayer", "line-color", [

"case",
[
"==",
[
"string", //<==========
"type"
]
,
"5"
],
"#686868",
"#686768"
]
)
```

so i beleave its happend because of the `get` expression.

i tested it also on the default mapbox style but woudnt get this behaviour.

this is the source config
```
{
"type": "vector",
"promoteId": {
"cable": "id"
},
"tiles": [
"https://xxxxx.com/{z}/{x}/{y}?regionId=yyyyy&scenarioId=defaultScenario&year=2025"
],
"bounds": [
6.005877,
51.617003,
6.229508,
51.791297
],
"minzoom": 10,
"maxzoom": 18
}
```

### Relevant log output

```shell

```

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 at the map.setPaintProperty entry point and reproduce the supplied vector-source case with the two line-color expressions, comparing tile requests for get versus string. Confirm the behavior with a minimal example and identify whether the extra requests are expected; done means the cause and a reliable regression test or reproduction are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.