From 031674b7f21c268fbf60fcbc98cbf20993933a84 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:22:55 +0000 Subject: [PATCH 1/5] Initial plan From ab9ad3a251a232f0e8a8459767bd4e9cf239cc0d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:28:52 +0000 Subject: [PATCH 2/5] Fix GTFS Flex feed detail map falling back to bounding box when no routes Agent-Logs-Url: https://github.com/MobilityData/mobilitydatabase-web/sessions/e2518ce7-973f-4065-a48e-56728012a9ae Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com> --- src/app/components/CoveredAreaMap.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/components/CoveredAreaMap.tsx b/src/app/components/CoveredAreaMap.tsx index 95ed442..c34b7c9 100644 --- a/src/app/components/CoveredAreaMap.tsx +++ b/src/app/components/CoveredAreaMap.tsx @@ -37,7 +37,10 @@ import { GtfsVisualizationMap } from './GtfsVisualizationMap'; import ZoomOutMapIcon from '@mui/icons-material/ZoomOutMap'; import { useRemoteConfig } from '../context/RemoteConfigProvider'; import { sendGAEvent } from '@next/third-parties/google'; -import { selectGtfsDatasetRoutesLoadingStatus } from '../store/supporting-files-selectors'; +import { + selectGtfsDatasetRoutesLoadingStatus, + selectGtfsDatasetRoutesTotal, +} from '../store/supporting-files-selectors'; import { getLatestGbfsVersion, type LatestDatasetLite, @@ -106,6 +109,7 @@ const CoveredAreaMap: React.FC = ({ const routesJsonLoadingStatus = useSelector( selectGtfsDatasetRoutesLoadingStatus, ); + const routesTotal = useSelector(selectGtfsDatasetRoutesTotal); const getAndSetGeoJsonData = (urlToExtract: string): void => { setGeoJsonLoading(true); @@ -166,6 +170,7 @@ const CoveredAreaMap: React.FC = ({ if ( feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && + !(routesJsonLoadingStatus === 'loaded' && routesTotal === 0) && boundingBox != undefined ) { setView('gtfsVisualizationView'); @@ -180,7 +185,7 @@ const CoveredAreaMap: React.FC = ({ return; } setView('boundingBoxView'); - }, [feed, routesJsonLoadingStatus, boundingBox, geoJsonData]); + }, [feed, routesJsonLoadingStatus, routesTotal, boundingBox, geoJsonData]); const handleViewChange = ( _: React.MouseEvent, @@ -279,9 +284,10 @@ const CoveredAreaMap: React.FC = ({ return ( feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && + !(routesJsonLoadingStatus === 'loaded' && routesTotal === 0) && boundingBox != undefined ); - }, [feed?.data_type, routesJsonLoadingStatus, boundingBox]); + }, [feed?.data_type, routesJsonLoadingStatus, routesTotal, boundingBox]); return ( Date: Tue, 14 Apr 2026 12:30:44 +0000 Subject: [PATCH 3/5] Improve readability: extract hasNoRoutes boolean in CoveredAreaMap Agent-Logs-Url: https://github.com/MobilityData/mobilitydatabase-web/sessions/e2518ce7-973f-4065-a48e-56728012a9ae Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com> --- src/app/components/CoveredAreaMap.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/components/CoveredAreaMap.tsx b/src/app/components/CoveredAreaMap.tsx index c34b7c9..e205873 100644 --- a/src/app/components/CoveredAreaMap.tsx +++ b/src/app/components/CoveredAreaMap.tsx @@ -110,6 +110,8 @@ const CoveredAreaMap: React.FC = ({ selectGtfsDatasetRoutesLoadingStatus, ); const routesTotal = useSelector(selectGtfsDatasetRoutesTotal); + const hasNoRoutes = + routesJsonLoadingStatus === 'loaded' && routesTotal === 0; const getAndSetGeoJsonData = (urlToExtract: string): void => { setGeoJsonLoading(true); @@ -170,7 +172,7 @@ const CoveredAreaMap: React.FC = ({ if ( feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && - !(routesJsonLoadingStatus === 'loaded' && routesTotal === 0) && + !hasNoRoutes && boundingBox != undefined ) { setView('gtfsVisualizationView'); @@ -284,10 +286,10 @@ const CoveredAreaMap: React.FC = ({ return ( feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && - !(routesJsonLoadingStatus === 'loaded' && routesTotal === 0) && + !hasNoRoutes && boundingBox != undefined ); - }, [feed?.data_type, routesJsonLoadingStatus, routesTotal, boundingBox]); + }, [feed?.data_type, routesJsonLoadingStatus, hasNoRoutes, boundingBox]); return ( Date: Tue, 14 Apr 2026 14:52:09 +0000 Subject: [PATCH 4/5] Pass totalRoutes as prop to CoveredAreaMap instead of reading from store Agent-Logs-Url: https://github.com/MobilityData/mobilitydatabase-web/sessions/b2b856c6-d6e9-4f2c-b3a4-104dd5c12915 Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com> --- src/app/components/CoveredAreaMap.tsx | 13 +++++-------- src/app/screens/Feed/FeedView.tsx | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/app/components/CoveredAreaMap.tsx b/src/app/components/CoveredAreaMap.tsx index e205873..a33e1ab 100644 --- a/src/app/components/CoveredAreaMap.tsx +++ b/src/app/components/CoveredAreaMap.tsx @@ -37,10 +37,7 @@ import { GtfsVisualizationMap } from './GtfsVisualizationMap'; import ZoomOutMapIcon from '@mui/icons-material/ZoomOutMap'; import { useRemoteConfig } from '../context/RemoteConfigProvider'; import { sendGAEvent } from '@next/third-parties/google'; -import { - selectGtfsDatasetRoutesLoadingStatus, - selectGtfsDatasetRoutesTotal, -} from '../store/supporting-files-selectors'; +import { selectGtfsDatasetRoutesLoadingStatus } from '../store/supporting-files-selectors'; import { getLatestGbfsVersion, type LatestDatasetLite, @@ -60,6 +57,7 @@ interface CoveredAreaMapProps { boundingBox?: LngLatTuple[]; latestDataset?: LatestDatasetLite; feed: AllFeedType; + totalRoutes?: number; } export const fetchGeoJson = async ( @@ -86,6 +84,7 @@ const CoveredAreaMap: React.FC = ({ boundingBox, latestDataset, feed, + totalRoutes, }) => { const t = useTranslations('feeds'); const tCommon = useTranslations('common'); @@ -109,9 +108,7 @@ const CoveredAreaMap: React.FC = ({ const routesJsonLoadingStatus = useSelector( selectGtfsDatasetRoutesLoadingStatus, ); - const routesTotal = useSelector(selectGtfsDatasetRoutesTotal); - const hasNoRoutes = - routesJsonLoadingStatus === 'loaded' && routesTotal === 0; + const hasNoRoutes = totalRoutes !== undefined && totalRoutes === 0; const getAndSetGeoJsonData = (urlToExtract: string): void => { setGeoJsonLoading(true); @@ -187,7 +184,7 @@ const CoveredAreaMap: React.FC = ({ return; } setView('boundingBoxView'); - }, [feed, routesJsonLoadingStatus, routesTotal, boundingBox, geoJsonData]); + }, [feed, routesJsonLoadingStatus, totalRoutes, boundingBox, geoJsonData]); const handleViewChange = ( _: React.MouseEvent, diff --git a/src/app/screens/Feed/FeedView.tsx b/src/app/screens/Feed/FeedView.tsx index 68ab550..e653de0 100644 --- a/src/app/screens/Feed/FeedView.tsx +++ b/src/app/screens/Feed/FeedView.tsx @@ -384,6 +384,7 @@ export default async function FeedView({ boundingBox={boundingBox} latestDataset={latestDataset} feed={feed} + totalRoutes={totalRoutes} /> )} From 7d32c50a4e8a28fe8dd24cb1722cadc5969eeb54 Mon Sep 17 00:00:00 2001 From: Alessandro Kreslin Date: Tue, 14 Apr 2026 10:58:58 -0400 Subject: [PATCH 5/5] logic fix to include failing at undefined --- src/app/components/CoveredAreaMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/CoveredAreaMap.tsx b/src/app/components/CoveredAreaMap.tsx index a33e1ab..2b098ac 100644 --- a/src/app/components/CoveredAreaMap.tsx +++ b/src/app/components/CoveredAreaMap.tsx @@ -108,7 +108,7 @@ const CoveredAreaMap: React.FC = ({ const routesJsonLoadingStatus = useSelector( selectGtfsDatasetRoutesLoadingStatus, ); - const hasNoRoutes = totalRoutes !== undefined && totalRoutes === 0; + const hasNoRoutes = totalRoutes == undefined || totalRoutes === 0; const getAndSetGeoJsonData = (urlToExtract: string): void => { setGeoJsonLoading(true);