Related Issue
This is similar to #991. The fix in PR #1014 was applied to SuperClusterAlgorithm but not to SuperClusterViewportAlgorithm.
Environment details
@googlemaps/markerclusterer: 2.6.2
- macOS 15.5 / Chrome 143.0.0.0 (arm64)
Steps to reproduce
- Create a
MarkerClusterer using SuperClusterViewportAlgorithm as the algorithm
- Initialize with an empty markers array, or call
clearMarkers()
Code example
import { MarkerClusterer, SuperClusterViewportAlgorithm } from "@googlemaps/markerclusterer";
const algorithm = new SuperClusterViewportAlgorithm({});
const clusterer = new MarkerClusterer({
map,
algorithm,
markers: [], // empty array triggers the bug
});
Stack trace
Uncaught TypeError: Cannot read properties of undefined (reading 'range')
at Supercluster.getClusters (index.js:105:26)
at SuperClusterViewportAlgorithm.cluster (superviewport.ts:114:8)
at SuperClusterViewportAlgorithm.calculate (superviewport.ts:102:28)
at MarkerClusterer.render (markerclusterer.ts:177:52)
at MarkerClusterer.onAdd (markerclusterer.ts:235:10)
Related Issue
This is similar to #991. The fix in PR #1014 was applied to
SuperClusterAlgorithmbut not toSuperClusterViewportAlgorithm.Environment details
@googlemaps/markerclusterer: 2.6.2Steps to reproduce
MarkerClustererusingSuperClusterViewportAlgorithmas the algorithmclearMarkers()Code example
Stack trace