react-leaflet-cluster
react-leaflet-cluster copied to clipboard
Update issue with the cluster
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