googlemaps / googlemaps/js-markerclusterer
Maps JavaScript API: Unable to hide AdvancedMarkerElement when used with MarkerClusterer
- Dominant language
- TypeScript
- Stars
- 293
- Forks
- 104
- Avg merge
- 3m
- Merged PRs (30d)
- 18
Description
I'm using AdvancedMarkerElements together with MarkerClusterer to display approximately 75 business locations on a map. Users can filter business locations by service type and state, and markers that do not meet filter conditions should be hidden.
To hide markers, I'm setting marker.map = null, [as per the documentation](https://developers.google.com/maps/documentation/javascript/advanced-markers/collision-behavior#control_marker_visibility_by_map_zoom_level). This works fine when displaying markers without a MarkerClusterer. However, with a MarkerClusterer the markers are initially hidden but reappear when the user scrolls or zooms the map.
I'm using Maps API version 3.60.1.
#### Steps to reproduce
1. See example code at https://jsfiddle.net/asthmaticcanary/u6qo31ds/24/
2. Add valid API key.
3. Click button to hide some markers by setting marker.map = null.
4. Scroll or zoom map and note that hidden markers reappear.
This is possibly related to https://github.com/googlemaps/js-markerclusterer/issues/867 but I think is a unique issue as it impacts basic location filtering functionality.
Contributor guide
Assessment
This issue has not been assessed yet.