Skip to content

Commit

Permalink
fix: prevent unnecessary rerendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ixam1 authored Nov 16, 2023
1 parent 1e61286 commit 155a732
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/markerclusterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ export class MarkerClusterer extends OverlayViewSafe {
// Delay the removal of old group markers to avoid flickering.
groupMarkers.push(cluster.marker);
}

this.clusters = clusters;
this.renderClusters();

// Delayed removal of the markers of the former groups.
requestAnimationFrame(() =>
groupMarkers.forEach((marker) => MarkerUtils.setMap(marker, null))
);
}

this.clusters = clusters;
this.renderClusters();

// Delayed removal of the markers of the former groups.
requestAnimationFrame(() =>
groupMarkers.forEach((marker) => MarkerUtils.setMap(marker, null))
);
}
google.maps.event.trigger(
this,
Expand Down

0 comments on commit 155a732

Please sign in to comment.