Closed garretteklof closed 1 week ago
@garretteklof I can't reproduce this issue, however, I found another issue relating to the map not loading sources/layers on initial load. I pushed a fix to canary
- can you test again using that?
Otherwise I'll need a link to the code you're working on.
I pulled and unfortunately it does not seem to resolve the feature-state
issue.
The platform code can be accessed here. It's right now the /demo
page.
@garretteklof I see the problem. When the layer checks if a GeoJSON feature has an id it uses a falsey check. Since 0
is a falsey value it triggers the "feature does not have id" warning.
@garretteklof Additionally, I think it would help to improve this console warning for better DX. I've opened https://github.com/dimapio/map-gl/issues/10 to improve this warning.
Console error
Attempted to set the feature state of a feature with no ID
on Layer with case statement inpaint
for a Source withgenerateId: true
.Note: when logging the feature in HoverPopup, the
id
is in fact generated:The
paint
statement is not executed (e.g. change in fill-color) and error leads to believe thatmapbox-gl
is never properly updated with the feature state.(
promoteId
does not seem to work either, in this specific case it'd bepromoteId: 'Id'
)