Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception when layer deleted while contextmenu open #129

Open
NathanMOlson opened this issue Apr 15, 2020 · 1 comment
Open

Unhandled exception when layer deleted while contextmenu open #129

NathanMOlson opened this issue Apr 15, 2020 · 1 comment

Comments

@NathanMOlson
Copy link

Thanks for the great library.

I'm using the contextmenu mixin with geoJSON features. The features are frequently updated by clearing the geoJSON layer and re-adding new features. It sometimes happens that a feature is removed while its context menu is open. When this happens, when the context menu is closed, an exception is thrown in Mixin.ContextMenu.js line 72 because this._map is null. After this, the list of contextmenu items gets out of sync and future contextmenus have spurious items.

The attached patch solves this issue for me.
handle_deleted_layer.patch.txt

@samcrawford
Copy link

samcrawford commented May 28, 2020

+1 on this patch. I am using leaflet-routing-machine with draggable markers, and I find that when I have a contextmenu associated with a marker and long-press the marker on mobile, the menu sometimes gets into a messy state and the callbacks are not fired. It looks like it's caused by the marker being dragged, which fires another event of mine that removes the marker. I tried this patch on a hunch, and it resolved my issue completely.

@boldtrn boldtrn mentioned this issue Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants