Skip to content

Commit 2dbce57

Browse files
committed
Remove usage of at()
1 parent 3a51ad4 commit 2dbce57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/maps/src/components/MapView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ const MapViewF = <T extends object>({
224224
() => getChildrenForType(MapMarkerCluster),
225225
[getChildrenForType]
226226
);
227-
const clusterView = React.useMemo(
228-
() => getChildrenForType(MapMarkerClusterView).at(0),
229-
[getChildrenForType]
230-
); //Only take the first, ignore any others
227+
const clusterView = React.useMemo(() => {
228+
const clusterViews = getChildrenForType(MapMarkerClusterView);
229+
return clusterViews.length ? clusterViews[0] : undefined; //Only take the first, ignore any others
230+
}, [getChildrenForType]);
231231

232232
if (autoClusterMarkers) {
233233
clusterMarkers(

0 commit comments

Comments
 (0)