Gmaps4rails Maximum call stack size exceeded?

2019-01-28 09:43发布

问题:

I've got the following setup, what I want to do is update the markers when a map is moved:

https://gist.github.com/277894809fe04cbc29c7

The json endpoint returns for example:

[{"_id":"4ecc19ca8de17b2f0f000001","latitude":47.413358,"location":[47.413358,9.744583],"longitude":9.744583,"name":"d2"},{"_id":"4ecc14e68de17b2924000001","latitude":47.413417,"location":[47.413417,9.744417],"longitude":9.744417,"name":"another"}]

but I get the following error when moving the map:

Uncaught RangeError: Maximum call stack size exceeded
I.get
a.(anonymous function)
tB.(anonymous function).zoomRange_changed
mf
I.set
(anonymous function)
tB.(anonymous function).zoomRange_changed
mf
I.set
......

No idea what causes this, I put together the sample from various sources, had to adapt a lot as it seems the methods etc changed a lot. Not sure if I missed something, I would be glad if someone could give me a pointer

Thanks a lot, Christoph

回答1:

In your json, you should replace: longitude with lng and latitude with lat.

But I should change the code to avoid this kind of weird surprises when arguments are malformed.



回答2:

It looks like that you have endless recursion in method I.set.