emilhe / dash-leaflet

MIT License
213 stars 37 forks source link

Error in EditControl Minimal example - No context provided #184

Closed rmourgues31 closed 1 year ago

rmourgues31 commented 1 year ago

Hello,

When replicating the example from https://dash-leaflet.herokuapp.com/#edit_control, I immediately get an error : No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>.

Is this normal ? How can it be fixed ?

Thanks

prl900 commented 1 year ago

Yes, seems this has broken recently. I cannot recover the functionality of EditControl even after downgrading to previous releases of dash-leaflet. Any ideas about how to fix this @emilhe? Thanks

emilhe commented 1 year ago

The documentation is running version 0.1.23. It looks like a regression introduced by the update to a newer version of react-leaflet since then.

EDIT: It seems to be related to a version incompatibility. I don't see any immediate fix (apart from rolling back to older package versions), so for now I would recommend to use an older version of dash-leaflet as a quick-fix. I am currently looking into a major dependency update, but it would require essentially a complete rewrite of dash-leaflet due to the many (breaking) changes introduced (in the underlying packages) through the last ~ 4 years.

prl900 commented 1 year ago

Thanks, @emilhe. Version 0.1.23 seems to work well. As you suggested using this version is a simple fix for apps that require this functionality.

It's great to hear you are looking into updating the library. I hope we can see the new improved version soon. Thanks for your work.

rmourgues31 commented 1 year ago

Thanks for the reply, I switched to 0.1.23 and it's fine for my purpose. Thank you for all the work !

emilhe commented 1 year ago

Fixed in the 1.0.1 release. Demo here: https://www.dash-leaflet.com/components/controls/edit_control

rmourgues31 commented 1 year ago

Awesome ! Thanks for your fantastic work