Bug: FeatureState makes id-field not useable when using promoteId
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
On init style is correct. But after setting and removing feature-state the style is visible different, but expression is the same.
This only happend by using promoteId and using [id] in style.
For example
this rule works ["==", ["get", "aid" ], 2 ]
this not ["==", ["id"], 2 ]
- also this happens only by the coresponding feature. For example by clicking on the gray circle, the red one will still be red.
- it doenst matter if
idis set forremoveFeatureState - looks like its a problem of setFeatureState, because if the feature-rule woudnt fit, it will also change the visible style.
map.setFeatureState({source: 'points',id: features[0].id,}, {selected: "anyValue"}); - also other expressions like distance doesnt workt
- also on
text-fieldthis doesnt work anyway, also without using feature-state https://jsfiddle.net/teb7605a/10/
mapbox-gl-js version: 2.5.0
browser: Chrome
Steps to Trigger Behavior
- open demo
- click on red circle (adds feature-state)
- click somewhere else (remove feature-state)
Link to Demonstration
https://jsfiddle.net/o6j1xmkw/1/
Expected Behavior
the selected circle should be red
Actual Behavior
the selected circle is gray.
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 JSFiddle and reproduce the behavior using promoteId, setFeatureState, removeFeatureState, and an [id] expression. Compare the [id] rule with the working get expression and test the reported text-field case. Done means the selected circle remains red after feature-state changes and the corresponding expressions update consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100