mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Features lose IDs in queryRenderedFeatures after setData with promoteId

Open 3zzy opened this issue 1 year ago • 0 comments

mapbox-gl-js version: 3.0.0

browser: Chrome

Steps to Trigger Behavior

  1. Load the map with a GeoJSON layer that has two features and promoteId: 'submissionID'.
  2. Use setData to update the GeoJSON source with additional features.
  3. Query rendered features on a map click and check the console for feature IDs.

Link to Demonstration

https://jsfiddle.net/iaezzy/5cphq7nd/1/

Expected Behavior

When querying rendered features after updating the GeoJSON source, the returned features should retain their IDs specified by the promoteId.

Actual Behavior

After updating the GeoJSON source using setData, querying rendered features returns features without their IDs, despite using promoteId to specify the property that should map to the feature ID.

A similar issue has been reported before which is probably still not fixed: https://github.com/mapbox/mapbox-gl-js/issues/10257

3zzy avatar Apr 29 '24 06:04 3zzy