-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't clear layer filter after being set #796
Comments
Also passing setFilter [] is invalid. Mapbox throws console errors when you try to do that. The proper way to set to an empty filter is by passing null. |
sorry for the delay & thanks for pointing this out – a fix was released under v4.8.2 |
Much appreciated sir |
Hello @mklopets, |
You are currently not able to clear a layer filter after it has been set.
For example: you set a filter on a layer to show a subset of the features by setting the prop. At some point, you want to clear your filter to show all features in that layer again. Setting the filter prop back to null does nothing.
The issue lies in this part of the componentWillReceiveProps
This would fix the issue
Mapbox says that map.setFilter(null) or map.setFilter(undefined) is the intended way to remove any existing filters off of a layer. See: https://docs.mapbox.com/mapbox-gl-js/api/#map#setfilter
The text was updated successfully, but these errors were encountered: