Skip to content
This repository was archived by the owner on Jan 17, 2026. It is now read-only.

Commit 350aaf0

Browse files
authored
Update map.tsx
1 parent f4def2e commit 350aaf0

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/lib/map.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ export default (props: T.Props) => {
1818
tabIndex = 0
1919
} = props;
2020
const [ geoUrl, setUrl ] = React.useState<string | null>(null);
21+
const [ notFound, setNotFound ] = React.useState<boolean>(false);
2122

2223
try {
2324
Geo.latLonFromAddress(address).then(x => {
25+
26+
if (x.length === 0) {
27+
setNotFound(true);
28+
}
29+
2430
const { lat, lon } = x[0];
2531

2632
const url = Geo.mapFromLatLon(lat, lon, zoomLevel, props.apiKey, lang);
@@ -29,6 +35,10 @@ export default (props: T.Props) => {
2935
} catch (err) {
3036
console.warn(err);
3137
}
38+
39+
if (notFound) {
40+
return <p><i>Address could not be placed on map</i></p>
41+
}
3242

3343
if (!geoUrl) {
3444
return LoadingComponent
@@ -43,4 +53,4 @@ export default (props: T.Props) => {
4353
aria-hidden="false"
4454
tabIndex={tabIndex}
4555
></iframe>
46-
}
56+
}

0 commit comments

Comments
 (0)