From 155a7324595e03330962e68f3fcd0403f62e2570 Mon Sep 17 00:00:00 2001 From: Maximilian Schaum <74653168+ixam1@users.noreply.github.com> Date: Thu, 16 Nov 2023 08:23:20 +0100 Subject: [PATCH] fix: prevent unnecessary rerendering --- src/markerclusterer.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/markerclusterer.ts b/src/markerclusterer.ts index a2611707..141a4242 100644 --- a/src/markerclusterer.ts +++ b/src/markerclusterer.ts @@ -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,