.setFeatureState() Doesn't Trigger Layer Transitions
Nobody has claimed this yet.
- 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
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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