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

Uncaught TypeError with release 2.0.0 in combination with MarkerCluster #312

Closed
KristjanESPERANTO opened this issue Nov 29, 2020 · 7 comments · Fixed by #314
Closed

Uncaught TypeError with release 2.0.0 in combination with MarkerCluster #312

KristjanESPERANTO opened this issue Nov 29, 2020 · 7 comments · Fixed by #314
Labels

Comments

@KristjanESPERANTO
Copy link
Contributor

I get an Uncaught TypeError in the browser console when using the new version 2.0.0.

In Chrome the error message is:

Events.js:190 Uncaught TypeError: Cannot read property 'fn' of undefined
    at NewClass.fire (Events.js:190)
    at NewClass.removeLayer (Layer.js:200)
    at NewClass.eachLayer (LayerGroup.js:123)
    at NewClass.onRemove (LayerGroup.js:111)
    at NewClass.removeLayer (Layer.js:189)
    at NewClass.removeFrom (Layer.js:70)
    at NewClass.remove (Layer.js:59)
    at NewClass.onRemove (leaflet.markercluster-src.js:648)
    at NewClass.removeLayer (Layer.js:189)
    at v2.0.0.html:37

In Firefox the error message is:

Uncaught TypeError: l is undefined
    fire Events.js:190
    removeLayer Layer.js:200
    eachLayer LayerGroup.js:123
    onRemove LayerGroup.js:111
    removeLayer Layer.js:189
    removeFrom Layer.js:70
    remove Layer.js:59
    onRemove leaflet.markercluster-src.js:648
    removeLayer Layer.js:189
    <anonymous> v2.0.0.html:37

This looks like there is a problem in MarkerCluster, but when I use the old version of leaflet-control-geocoder this problem does not occur.

I've created a rudimentary example to comprehend the issue. The only difference is the version number of leaflet-control-geocoder.
v1.13.0.html - old version without error
v2.0.0.html - new version with error

@gemmavnash
Copy link

gemmavnash commented Nov 30, 2020

I've got the same error and I'm not using the marker clusterer, but I am using L.shapeMarker. So maybe it's paths or divIcons it has issues with?
I'm using this library via unpkg across a lot of my portals, so really need this fixed asap. Please and thank you.
Update; sorry, it's a similar error, not the same:

Events.js:190 Uncaught TypeError: Cannot read property 'fn' of undefined
    at i.fire (Events.js:190)
    at i.removeLayer (Layer.js:200)
    at i.closeTooltip (Tooltip.js:241)
    at i._close (Tooltip.js:118)
    at i.closeTooltip (Tooltip.js:349)
    at i.fire (Events.js:190)
    at i._fireDOMEvent (Map.js:1440)
    at i._handleDOMEvent (Map.js:1397)
    at HTMLDivElement.c (DomEvent.js:92)

@mrAceT
Copy link

mrAceT commented Nov 30, 2020

Same here, I first thought the problem was with Markercluster or leaflet, but it starts when geocoder is initiated..

I made a test also:
https://www.geoarchief.nl/test/GeoCoderBug.html

Thank you for mentioning the old version does not have the problem, will use that one for now..

@mmcc5678
Copy link

Eugh, I just spent nearly 2 days trying to figure this. Such a N00b at JS but eventually...got here. Will make sure I version tie from here on in!

@gemmavnash
Copy link

I've just added the version to all my portals, and it's working again, so it's a lesson for me too. It didn't even cross my mind that a new version would be deployed at the same location.

@simon04
Copy link
Collaborator

simon04 commented Nov 30, 2020

Sorry for breaking the event handling with the 2.0.0 release. Bringing together leaflet mixins and TypeScript wasn't easy and my approach for the 2.0.0 release turned out erroneous. A few minutes ago, I've released 2.0.1 which should address this issue.

@KristjanESPERANTO
Copy link
Contributor Author

Thanks for the fast fix!

@gemmavnash
Copy link

thanks, that seems to have worked. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants