`addfeature` and `removefeature` events are called too often since v2.4.0 when using minZoom/maxZoom
gavinr opened this issue · 2 comments
Describe the bug
Since Esri Leaflet v2.4.0, the addfeature
and removefeature
events are not working properly on a FeatureLayer with a minZoom/maxZoom.
Expected behavior
When there is a minZoom
or maxZoom
defined on the layer, the addfeature
and removefeature
events should get called as the user zooms "when a feature on the layer is removed from the map" (removefeature
) and "when a previously removed feature is added back to the map" (addfeature
) (quotes from the docs)
Actual behavior
As you zoom out and in, the addfeature
and removefeature
events are fired too many times.
To Reproduce
Esri Leaflet v2.3.3 - working as expected: https://jsbin.com/duyupof/edit?html,output
- Open the developer tools
- Zoom out 3-4 times
- Notice that "remove feature" events are only fired once when the points disappear (expected).
Esri Leaflet v3.0.3 (latest) - NOT working as expected: https://jsbin.com/yoyifa/2/edit?html,output
- Open the developer tools
- Zoom out 3-4 times
- Notice that "remove feature" events are fired multiple times. Expected: Only fire once.
Environment Information
- Version of Leaflet (
L.version
): 1.7.1 - Version of Esri Leaflet (
L.esri.VERSION
): happening on > v2.4.0
Additional context
Thank you!