mapbox / mapbox/mapbox-gl-js

feature-state expression is incorrectly evaluated in queryRenderedFeatures

Open
#10,103 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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**: 1.12.0

**browser**: Google Chrome v86

### Steps to Trigger Behavior
1. Use `feature-state` expression in a paint property for a symbol feature
2. Query this feature using `queryRenderedFeatures`

### Link to Demonstration
https://jsfiddle.net/osvodef/sdtr63jp/24/

### Expected Behavior
Feature state is taken into account, correct value of the property is returned.

### Actual Behavior
Default value of the property is returned.

The bug only affects symbol features. As far as I understood, this is because `lookupSymbolFeatures` doesn't pass `sourceFeatureState` arg to `loadMatchingFeatures` (in the file `feature_index.js`).

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 lookupSymbolFeatures and loadMatchingFeatures in feature_index.js, then reproduce the symbol-feature case from the linked JSFiddle. Verify that queryRenderedFeatures returns the property value produced by feature-state rather than the default value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.