mapbox / mapbox/mapbox-gl-js

.setFeatureState() Doesn't Trigger Layer Transitions

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

Nobody has claimed this yet.

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

Description

When using .setPaintProperty(), transitions work okay. However, if I .setFeatureState() and conditionally set a style in the layer using an expression, the transition does not work.

mapbox-gl-js version: 2.14.1 (discovered in 2.8.2)

browser: Firefox

Steps to Trigger Behavior
  1. Set access token on line 36
Link to Demonstration

https://stackblitz.com/edit/mapbox-mapboxgl-dq9xg8?file=index.html

Expected Behavior

'line-color' should transition

(in stackblitz, uncomment lines 118-123 and comment out 109-116 to see what it should be)

Actual Behavior

'line-color' does not transition

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 StackBlitz reproduction in index.html and run the demonstrated setFeatureState and setPaintProperty cases side by side. Confirm that the conditional line-color expression fails to transition while the direct paint update does, then trace the relevant transition handling in the repository. Done means the feature-state-driven line-color transition behaves like the direct update and the regression is covered by a test.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.