Getting error when using renderer in Vue2Leaflet LCircleMarker
See original GitHub issueIn the vue2-leaflet
package, when I use the l-circle-marker
component with v-for
and renderer
together, I get the following error:
RangeError: Maximum call stack size exceeded
notice that:
- I checked using of the
renderer
withoutv-for
and it works correctly. - The
renderer
is a computed property and I can use it in any desired method (calling it likethis.renderer()
), but it causes createcanvas
tag for eachl-circle-marker
in HTML DOM and I won’t such thing.
e.g. https://codesandbox.io/s/v2l-circlemarker-renderer-forked-lq53u
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Vue Leaflet not rendering map - Stack Overflow
I've the following code(below) and so far what I can see is white page, without any error on the console. I want to...
Read more >#vue2leaflet - Twitter Search / Twitter
See Tweets about #vue2leaflet on Twitter. See what people are saying and join the ... Getting error when using renderer in Vue2Leaflet LCircleMarker...
Read more >Vue2Leaflet - Bountysource
In the vue2-leaflet package, when I use the l-circle-marker component with v-for and renderer together, I get the following error:.
Read more >FAQ | Vue Leaflet
To fix map rendering issues, it may help to import the Leaflet stylesheet within ... with Leaflet marker icons' paths, resulting in warnings...
Read more >Vue Leaflet - GitLab
All leaflet methods are available through a vue ref and the data layer ... LCircleMarker example, click the circle to change his location,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have done some more digging into this issue. The problem seems to be in adding a Vue watch on the Leaflet
Canvas
instance, although I haven’t yet tracked down why it only happens when a second instance is added. Somehow once there are two of them, there’s a circular reference somewhere that is leading to never-ending recursion. The issue seems very similar to vuejs/vue/issues/9081, although in this case we aren’t trying to add a watch on a Vue object, or nest two different components with the same name. But if there is a circular reference, then the behaviour would end up being the same I think, and it is definitely the_traverse
function called while adding the watch where we’re seeing this issue, just as in that one.Work-around
For the case where the real problem is wanting to render all circle markers and other vector layers with canvas instead of SVG, and you don’t really care whether a renderer is specified for each of those components as long as they end up on the canvas, a work-around seems to be to add
preferCanvas: true
to the<l-map>
options.Here’s a fork of the initial repro above, with the circle marker options removed and
preferCanvas
used on the map: https://codesandbox.io/s/v2l-circlemarker-renderer-forked-uluy8?file=/src/App.vueIt both loads correctly with all of the circle markers, and puts them all into the canvas element instead of creating DOM nodes for each one.
@Alireza-Sadeghi-0123, let me know if that option works to get you past this issue. In the meantime, I’ll keep digging.
I checked the map in two states: 1.
preferCanvas: true
, and 2.renderer: L.canvas({ padding: 0, tolerance: 0 })
and I saw that huge points in both states cause lag in the map. Finally, I foundleaflet-pixi-overlay
plugin to manage huge points with pixi renderer. This plugin usesWebGL
instead ofCanvas
and it let us render many markers (more than one million) on the map.