Skip to content

Maps JavaScript API: Unable to hide AdvancedMarkerElement when used with MarkerClusterer #961

@ffordian

Description

@ffordian

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. 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 #867 but I think is a unique issue as it impacts basic location filtering functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions