question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError with release 2.0.0 in combination with MarkerCluster

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mmcc5678commented, Nov 30, 2020

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!

1reaction
simon04commented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: this.callInitHooks is not a function - Stack ...
You have forgot to add new , it should look like: var markers = new L.MarkerClusterGroup();. Else you can the shortcut version with...
Read more >
react-leaflet-markercluster - Bountysource
I'm using react-leaflet-markercluster with with children markers and getting TypeError: Cannot read property 'lat' of undefined when I update the markers.
Read more >
react-leaflet-markercluster - npm
React wrapper of Leaflet.markercluster for react-laeflet. Latest version: 3.0.0-rc1, last published: 2 years ago.
Read more >
Marker Clustering | Maps JavaScript API - Google Developers
This tutorial shows you how to use marker clusters to display a large number of markers on a map. You can use the...
Read more >
Leaflet markerClusterGroup 'undefined is not a function'
You should add the script that loads the markercluster plugin after you've loaded the core leaflet application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found