File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -68,13 +68,10 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
6868 const position = MarkerUtils . getPosition ( marker ) ;
6969 const coordinates = [ position . lng ( ) , position . lat ( ) ] ;
7070 return {
71- type : "Feature" as const ,
72- geometry : {
73- type : "Point" as const ,
74- coordinates,
75- } ,
71+ type : "Feature" ,
72+ geometry : { type : "Point" , coordinates } ,
7673 properties : { marker } ,
77- } ;
74+ } as const ;
7875 } ) ;
7976 this . superCluster . load ( points ) ;
8077 }
@@ -87,6 +84,13 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
8784
8885 this . state = state ;
8986
87+ // when input is empty, return right away
88+ if ( input . markers . length === 0 ) {
89+ this . clusters = [ ] ;
90+
91+ return { clusters : this . clusters , changed } ;
92+ }
93+
9094 if ( changed ) {
9195 this . clusters = this . cluster ( input ) ;
9296 }
You can’t perform that action at this time.
0 commit comments