Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.98k stars 994 forks source link

Errors in console when remove layer (leaflet@1.5.1) #937

Open ashmigelski opened 5 years ago

ashmigelski commented 5 years ago

Hey After update to leaflet@1.5.1 I noticed errors in console after layer.remove().

errrr

Problem is somewhere between Leaflet.Draw and Leaflet

My layers have no poly.option.original so is undifined and Leaflet.Draw calls poly.setState(undefined). Updated leaflet@1.5.1 can't handle it :cry:

How to reproduce

Minimal example reproducing the issue

https://next.plnkr.co/edit/ueXrIorKU5nPlA9P