@@ -57,6 +57,7 @@ interface CoveredAreaMapProps {
5757 boundingBox ?: LngLatTuple [ ] ;
5858 latestDataset ?: LatestDatasetLite ;
5959 feed : AllFeedType ;
60+ totalRoutes ?: number ;
6061}
6162
6263export const fetchGeoJson = async (
@@ -83,6 +84,7 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
8384 boundingBox,
8485 latestDataset,
8586 feed,
87+ totalRoutes,
8688} ) => {
8789 const t = useTranslations ( 'feeds' ) ;
8890 const tCommon = useTranslations ( 'common' ) ;
@@ -106,6 +108,7 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
106108 const routesJsonLoadingStatus = useSelector (
107109 selectGtfsDatasetRoutesLoadingStatus ,
108110 ) ;
111+ const hasNoRoutes = totalRoutes == undefined || totalRoutes === 0 ;
109112
110113 const getAndSetGeoJsonData = ( urlToExtract : string ) : void => {
111114 setGeoJsonLoading ( true ) ;
@@ -166,6 +169,7 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
166169 if (
167170 feed ?. data_type === 'gtfs' &&
168171 routesJsonLoadingStatus != 'failed' &&
172+ ! hasNoRoutes &&
169173 boundingBox != undefined
170174 ) {
171175 setView ( 'gtfsVisualizationView' ) ;
@@ -180,7 +184,7 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
180184 return ;
181185 }
182186 setView ( 'boundingBoxView' ) ;
183- } , [ feed , routesJsonLoadingStatus , boundingBox , geoJsonData ] ) ;
187+ } , [ feed , routesJsonLoadingStatus , totalRoutes , boundingBox , geoJsonData ] ) ;
184188
185189 const handleViewChange = (
186190 _ : React . MouseEvent < HTMLElement > ,
@@ -279,9 +283,10 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
279283 return (
280284 feed ?. data_type === 'gtfs' &&
281285 routesJsonLoadingStatus != 'failed' &&
286+ ! hasNoRoutes &&
282287 boundingBox != undefined
283288 ) ;
284- } , [ feed ?. data_type , routesJsonLoadingStatus , boundingBox ] ) ;
289+ } , [ feed ?. data_type , routesJsonLoadingStatus , hasNoRoutes , boundingBox ] ) ;
285290
286291 return (
287292 < Box
0 commit comments