I have an if block in my template to choose between layers.marker or layers.geojson depending on my data, so I was updating my @bounds={{this.bounds}} with this.bounds = layer.getBounds() inside @onLayeradd. This seems to work fine, but for some reason in test--some few tests after the actual test that contains the map--I get the following error that fails a later unrelated test:
TypeError: Cannot read properties of undefined (reading '_leaflet_pos')
Source:
TypeError: Cannot read properties of undefined (reading '_leaflet_pos')
at getPosition (http://localhost:7357/assets/vendor.js:62595:14)
at NewClass._getMapPanePos (http://localhost:7357/assets/vendor.js:64633:12)
at NewClass._getNewPixelOrigin (http://localhost:7357/assets/vendor.js:64650:69)
at NewClass._move (http://localhost:7357/assets/vendor.js:64369:30)
at NewClass._onZoomTransitionEnd (http://localhost:7357/assets/vendor.js:64871:10)
I changed my code to set bounds from the start (L.geoJSON(this.geoJSON).getBounds()) and it the error seems to go away. I'll be using this new pattern from here on out, but figured I'd put up an issue considering if @bounds is intended to be updatable.
I have an
if
block in my template to choose betweenlayers.marker
orlayers.geojson
depending on my data, so I was updating my@bounds={{this.bounds}}
withthis.bounds = layer.getBounds()
inside@onLayeradd
. This seems to work fine, but for some reason in test--some few tests after the actual test that contains the map--I get the following error that fails a later unrelated test:Stack trace:
I changed my code to set bounds from the start (
L.geoJSON(this.geoJSON).getBounds()
) and it the error seems to go away. I'll be using this new pattern from here on out, but figured I'd put up an issue considering if@bounds
is intended to be updatable.