Skip to content

Commit f779449

Browse files
SatishGandhamSatish Gandham
andauthored
Fix Map Widget crash appsmithorg#3843 (appsmithorg#4031)
* Fix map method being called on undefined varaible in MapComponent appsmithorg#3843 Sentry Issue: APPSMITH-N5 * Add type to marker property appsmithorg#3843 Co-authored-by: Satish Gandham <satish@appsmith.com>
1 parent dc7d002 commit f779449

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

app/client/src/components/designSystems/appsmith/MapComponent.tsx

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,30 @@ const MyMapComponent = withGoogleMap((props: any) => {
140140
<StyledInput type="text" placeholder="Enter location to search" />
141141
</SearchBox>
142142
)}
143-
{props.markers.map((marker: any, index: number) => (
144-
<Marker
145-
key={index}
146-
title={marker.title}
147-
position={{ lat: marker.lat, lng: marker.long }}
148-
clickable
149-
draggable={
150-
props.selectedMarker &&
151-
props.selectedMarker.lat === marker.lat &&
152-
props.selectedMarker.long === marker.long
153-
}
154-
onClick={() => {
155-
setMapCenter({
156-
...marker,
157-
lng: marker.long,
158-
});
159-
props.selectMarker(marker.lat, marker.long, marker.title);
160-
}}
161-
onDragEnd={(de) => {
162-
props.updateMarker(de.latLng.lat(), de.latLng.lng(), index);
163-
}}
164-
/>
165-
))}
143+
{Array.isArray(props.markers) &&
144+
props.markers.map((marker: MarkerProps, index: number) => (
145+
<Marker
146+
key={index}
147+
title={marker.title}
148+
position={{ lat: marker.lat, lng: marker.long }}
149+
clickable
150+
draggable={
151+
props.selectedMarker &&
152+
props.selectedMarker.lat === marker.lat &&
153+
props.selectedMarker.long === marker.long
154+
}
155+
onClick={() => {
156+
setMapCenter({
157+
...marker,
158+
lng: marker.long,
159+
});
160+
props.selectMarker(marker.lat, marker.long, marker.title);
161+
}}
162+
onDragEnd={(de) => {
163+
props.updateMarker(de.latLng.lat(), de.latLng.lng(), index);
164+
}}
165+
/>
166+
))}
166167
{props.enablePickLocation && (
167168
<PickMyLocationWrapper
168169
title="Pick My Location"

0 commit comments

Comments
 (0)