Keep feature.id
as cluster_id
even when promoteId
is set to something else
#10094
Labels
bug 🐞
needs investigation 🔍
Issues that require further research (e.g. it's not clear whether it's GL JS or something else)
Motivation
Currently trying to add a hover effect to my clusters, but
setFeatureState
cannot target the clusters as they do not have any ID. The reason being mypromoteId
is set to a custom property from my GeoJSON source.Design Alternatives
Suggestion 1
Ignore
promoteId
for cluster features.Suggestion 2 - follow the spec
The style spec says that you can target individual layers for
promoteId
, but this is false. SettingpromoteId
as following does not work:If this was to work as the style spec suggests, it would solve the problem.
Design
As suggestion 2 is already following the spec, I assume that would be the most correct way of implementing it, but I don't see any drawbacks with suggestion 1.
Suggestion 1 has the advantage of working without having to specify layer source ids - this can be especially painful if you have a lot of layers you need to target.
Mock-Up
It will not make any changes, except following the spec if that suggestion is chosen.
Concepts
Should add a note in the spec that clusters will use
cluster_id
instead ofpromoteId
, if suggestion 1 is accepted.Implementation
I do not have enough knowledge of the mapbox internals to answer this 😅
End notes
Thanks for taking the time to read my suggestion. If there already is a solution to my problem, I've not found it and would love to be pointed in the right direction. Even so the spec do tell me something that is not true, so I believe this will need to be solved either way. In any case, thanks again, and if my issue has problems, or I misunderstood some of the headers, please correct me! 😁
The text was updated successfully, but these errors were encountered: