Esri / Esri/esri-leaflet-vector

Error when calling `onRemove` if the creation failed

Open
#147 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
72
Forks
54
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

From @corrigancd in #140:

> When a layer fails to load, even if the error is handled (#146), in our app there is a function which calls `leafletMap.removeLayer` to clear layers before re-adding them. This triggers the `onRemove` function in `vectorTileLayer` and `map.removeLayer(this._mapboxGL)` was called. The the problem was that `this._mapboxGL` was never initialized because the `_createLayer` function was exited early. So a check was added to make use that `this.mapboxGL` exists before calling remove.

### Reproduction

tbd ... I'll try to follow up with this, or @corrigancd are you able to provide reproduction steps?

### Logs

```shell
tbd
```

### System Info

```shell
coming soon
```

### Additional Information

Proposed solution from @corrigancd in #140: https://github.com/Esri/esri-leaflet-vector/pull/140/files#diff-d87a7a0181c4fb7f5a10b32e3494597f82c320b55306aa848df45d586513b30eR144-R146

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.