react-leaflet-cluster icon indicating copy to clipboard operation
react-leaflet-cluster copied to clipboard

Update issue with the cluster

Open VisileanAnujS opened this issue 1 year ago • 0 comments

Hello @akursat @prorokky , i am having trouble rendering the updated layers with the marker cluster, i have tried updating the key to force re render but it is affecting the shapes . there will be frequent updates to the layers how can i update the cluster ?

Main component:-

export const MarkerClustering = memo(function MarkerClustering({
	children
}: {
	children: ReactNode;
}) {
	const { clusterKey } = useSelector((state: RootState) => state.mapData);

	return (
		<>
			<MarkerClusterGroup
				showCoverageOnHover={false}
				chunkDelay={200}
				pmIgnore={true}
				key={clusterKey}
				animateAddingMarkers={true}
				disableClusteringAtZoom={18}
			>
				{children}
			</MarkerClusterGroup>
		</>
	);
});

usage :-

<MarkerClustering>
      {allLayersJson &&
          allLayersJson.map((item: any) => {
          return <LayerGroupRender item={item} key={item?.guid} />;
          })}
      <InitialiseMaps />
</MarkerClustering>

Libraries used : -

  • geoman
  • react-leaflet

after forcing re render Screenshot from 2024-07-02 18-57-50

VisileanAnujS avatar Jul 02 '24 13:07 VisileanAnujS