googlemaps / googlemaps/js-markerclusterer

[BUG] hide/show advanced markers does not work

Open
#625 9 comments 1 reaction 2 assignees Claimed by @wangela View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
293
Forks
104
Avg merge
3m
Merged PRs (30d)
18

Description

#### Environment details

I am using the beta channel of Google Maps and `@googlemaps/markerclusterer` at 2.1.3

I am adding a bunch of marker to a clusterer:

```js
for (const launch of this.launches) {
markers.push(
new google.maps.marker.AdvancedMarkerElement({
position: { lat: launch.lat, lng: launch.lon },
title: launch.title,
}),
);
}
this.clusterer.addMarkers(markers);
this.clusterer.setMap(this.map);
```

At this point everything works fine.

Then I hide the markers:

```js
this.clusterer.setMap(null);
```

After that all the markers are hidden as expected

Then I want to show the markers again:

```js
this.clusterer.setMap(this.map);
this.clusterer.render(); // calling that makes no difference
```

That has no effect.
I would effect the marker the show after this call.
But I have to zoom (either in on out) for the marker to re-appear.

I would be up to create a repro if you have a starter template - all the GMaps starters for the JS API website seem to have an issue with the API key.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.