js-markerclusterer icon indicating copy to clipboard operation
js-markerclusterer copied to clipboard

fix: prevent unnecessary rerendering of clusters when nothing has changed

Open ixam1 opened this issue 2 years ago • 4 comments

This PR fixes the unnecessary rerendering of clusters when nothing has changed.

Fixes #801 🦕

The fix is pretty simple, just compare the amount of clusters from before and after and if its the same -> dont render.

Correct me if I am wrong I am no expert in the algorithms used here, but this should cover all cases right? Since whenever clusters are changing they will either combine or decluster and in either way the amount of clusters will decrease or increase, so this simple check should work.

without fix with fix
fractional zoom with animation
normal zoom with animation
fractional zoom without animation

ixam1 avatar Nov 17 '23 09:11 ixam1

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Nov 17 '23 09:11 google-cla[bot]

Thanks @ixam1 for offering this fix; please make sure to sign the CLA so that doesn't block merging of your pull request.

wangela avatar Dec 05 '23 23:12 wangela

This doesn't quite sit right with me. It seems to work, but I feel like checking the number of clusters as a proxy for "has anything changed" isn't accurate enough.

Why don't we fix the "changed" flag being returned instead, since obviously the algorithms don't properly signal changes to the markerclusterer?

usefulthink avatar Dec 11 '23 18:12 usefulthink

Thank you for these fixes, @ixam1 . Could you please let me know when we can expect to release them?

gopinath-sixt avatar Oct 08 '24 12:10 gopinath-sixt