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

Error thrown when clustering after leaflet flyToBounds() function. Reproduced in jsFiddle #740

Open
guanzo opened this issue Dec 6, 2016 · 4 comments

Comments

@guanzo
Copy link

guanzo commented Dec 6, 2016

jsFiddle: https://jsfiddle.net/k4b56h79/14/

Problem: I use leaflets flyToBounds function, and attach a listener for the zoomend event. In the event callback, i add a cluster of markers to the map. I get an error message Uncaught TypeError: Cannot read property 'lat' of undefined.

Steps to reproduce:

  1. Open dev console (i'm using chrome)
  2. Click the zoom button.
  3. Click the world button.

The error should be thrown by now, if not, repeat steps 2 and 3.

I've managed a workaround by wrapping the zoomend callback with a 50 ms timeout, like so
https://jsfiddle.net/guanzo/k4b56h79/12/

It also works if i remove the flyToBounds function entirely.
https://jsfiddle.net/guanzo/k4b56h79/13/

@amiiit
Copy link

amiiit commented Dec 29, 2016

In the given fiddle, could you please replace the sources fromleaflet.js and leaflet.markercluster.js with leaflet-src.js and leaflet.markercluster-src.js accordingly? This will allow to do some debugging in the console.

@guanzo
Copy link
Author

guanzo commented Jan 2, 2017

Done. https://jsfiddle.net/k4b56h79/14/

This is related to #743, if i remove the chunkedLoading option, the error disappears.

@amiiit
Copy link

amiiit commented Jan 4, 2017

For what it's worth and without knowing the code too well, it seems to me that the Infinity value that causes the error starts here:

return this._mapBoundsInfinite;

Is there anyone here that knows more about it that can help investigate this?

@stereobooster
Copy link

Have similar error. yuzhva/react-leaflet-markercluster#71 (comment)

execution gets to this point:

function toLatLngBounds(a, b) {
	if (a instanceof LatLngBounds) {
		return a;
	}
	return new LatLngBounds(a, b);
}

where a is LatLngBounds (it has all the same methods), but it is not instance of LatLngBounds (it identifies itself as B).

Screenshot 2019-10-14 at 11 44 24

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

3 participants