dimfeld / svelte-maplibre

Svelte bindings for the MapLibre mapping library
https://svelte-maplibre.vercel.app
MIT License
283 stars 34 forks source link

Merge featureState from multiple sources #67

Closed dimfeld closed 9 months ago

dimfeld commented 9 months ago

With the upcoming #65, we'll run into issues if multiple places are trying to setFeatureState on the same feature with different pieces of state. This could happen when JoinedData and a Layer with manageHoverState are both used.

The solution is probably to make a separate piece of code which can merge the hover state with other state. Then everything that currently calls $map.setFeatureState could call that code instead. While this could be made generic, it's probably simplest to just make it work with a hover value and one other optional state object.

dimfeld commented 9 months ago

Per @stuartlynn in #65, Maplibre already handles this internally.