lhapaipai / maplibre-react-components

React bindings for MapLibre GL JS
https://maplibre-react-components.pentatrion.com/
Other
5 stars 1 forks source link

`RSource`: map.style is undefined on un/remount #5

Closed andrejilderda closed 2 months ago

andrejilderda commented 2 months ago

maplibre-react-components version

0.1.7

your OS, React version

macOS, React 18.2.0

Description

I found a case where an Uncaught TypeError: map.style is undefined-error is thrown for this line when a map containing a RSource and/or RLayer was remounting. As the error implies the style property on map is accessed but not defined at that moment.

How to reproduce

I have tried to create a small reproduction in Storybook that was very similar to my setup, but unfortunately couldn't trigger the error.

Possible Solution

🕊️ PR incoming.

lhapaipai commented 2 months ago

thanks @andrejilderda, fix is available in v0.1.8 Have a good evening !