removeLayer method throws an error
See original GitHub issueHere it the code-fragment for ‘removeLayer’:
removeLayer: function (layer) {
var id = L.Util.stamp(layer);
var _layer = this._getLayer(id);
if (_layer) {
delete this.layers[this.layers.indexOf(_layer)]; // `this.layers` should be replaced with `this._layers`
}
this._update();
return this;
}
Instead of this.layers
should be this._layers
i guess.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React-leaflet LayersControl throws error when moving code ...
removeLayer is not a function ". What I do not understand is: if I comment out the "TestOverlay" component, it compiles. There seems...
Read more >removeLayer() error - Esri Community
Hello- I'm simply trying to remove a layer from an aprx using arcpy and am getting an error related to the save() function....
Read more >Error attempting to remove layer using arcpy in ArcGIS Pro?
The removeLayer method is expecting a Layer object not the raster name as a string. Try using the listLayers method on the map...
Read more >mapbox-gl-utils - npm
Adds U property to map, containing these methods. ... 'toplayer'); // removeLayer() doesn't throw errors if the layers don't exist map.
Read more >API · cornerstone
getImage function a function that returns a JavaScript Image object with the image ... Check if the supplied parameter is undefined and throws...
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
Calling delete on the array index is not sufficient, as it is later iterated over; delete removes the index from the array, causing the deleted index’s value to be ‘undefined’ when expecting an object. Instead, you must splice the item from the array to leave the indexes continuous.
The current pull request #50 is insufficient. I had included a fix in my pull request #46 (an unrelated feature request).
Please, accept the PR to fix the issue caused by using delete on array.