mapbox / mapbox-gl-leaflet

binding from Mapbox GL JS to the Leaflet API
ISC License
522 stars 155 forks source link

gl tile layer crashes with webkitTransitionEnd event #77

Closed fogfish closed 6 years ago

fogfish commented 6 years ago

The issue is reproducible when you are using the gl layer in react base application together with react-leaflet.

It crashes with following error when component is destroyed:

TypeError: undefined is not an object (evaluating 'obj[eventsKey]')
at
removeOne leaflet-src 2708

The original TileLayer works as expected.

It is hard to say what component is root cause. However, it is trigged due to undefined _map._proxy at onRemove. https://github.com/mapbox/mapbox-gl-leaflet/blob/master/leaflet-mapbox-gl.js#L87

It see extremely trivial fix here.