Skip to content

Fix GTFS Flex feed detail map defaulting to bounding box when feed has no routes#112

Merged
Alessandro100 merged 5 commits intomainfrom
copilot/gtfs-flex-feeds-detail-map-fix
Apr 14, 2026
Merged

Fix GTFS Flex feed detail map defaulting to bounding box when feed has no routes#112
Alessandro100 merged 5 commits intomainfrom
copilot/gtfs-flex-feeds-detail-map-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

GTFS Flex feeds can have zero routes. When routes.json loads successfully but returns an empty array, CoveredAreaMap was staying on gtfsVisualizationView and rendering a blank map instead of falling back to the bounding box.

Changes

  • CoveredAreaMap.tsx: Added selectGtfsDatasetRoutesTotal selector and a hasNoRoutes derived boolean (status === 'loaded' && total === 0). Both the view-determination effect and enableGtfsVisualizationView memo now treat an empty-routes load the same as a failed load — falling back to boundingBoxView and disabling the visualization toggle.
const hasNoRoutes = routesJsonLoadingStatus === 'loaded' && routesTotal === 0;

// view effect
if (feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && !hasNoRoutes && boundingBox != undefined) {
  setView('gtfsVisualizationView');
  return;
}
setView('boundingBoxView');

// toggle button enablement
const enableGtfsVisualizationView = useMemo(() =>
  feed?.data_type === 'gtfs' && routesJsonLoadingStatus != 'failed' && !hasNoRoutes && boundingBox != undefined,
  [feed?.data_type, routesJsonLoadingStatus, hasNoRoutes, boundingBox]
);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node index.js --exec install (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node dist/index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Apr 14, 2026 3:00pm

Request Review

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Alessandro100
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix detailed map display for Flex GTFS feeds without routes Fix GTFS Flex feed detail map defaulting to bounding box when feed has no routes Apr 14, 2026
Copilot AI requested a review from Alessandro100 April 14, 2026 12:32
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot CoveredAreaMap component should get it's route data passed as a prop and not rely on the store

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in bfe0896. Added totalRoutes?: number to CoveredAreaMapProps and replaced the selectGtfsDatasetRoutesTotal store selector with the prop-derived value. FeedView (which already receives totalRoutes from the server-side fetch) now passes it down to CoveredAreaMap. The hasNoRoutes boolean is now computed as totalRoutes !== undefined && totalRoutes === 0.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node index.js --exec install (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node dist/index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions
Copy link
Copy Markdown

*Lighthouse ran on https://mobilitydatabase-p2jfugv8j-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 97 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-p2jfugv8j-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 89 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-p2jfugv8j-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 52 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-p2jfugv8j-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 97 🟠 84 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-p2jfugv8j-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 82 🟢 94 🟢 96 🟢 100

@Alessandro100 Alessandro100 marked this pull request as ready for review April 14, 2026 19:03
Copy link
Copy Markdown
Contributor

@Alessandro100 Alessandro100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran it locally and it works for the feed /feeds/gtfs/mdb-3081

@Alessandro100
Copy link
Copy Markdown
Contributor

To test visit: https://mobilitydatabase-web-git-copilot-gtfs-flex-82520f-mobility-data.vercel.app/feeds/gtfs/mdb-2290 (a flex feed). Zoom out with your mouse on the map. For this ticket it fixes it in the sense that the detailed map doesn't show up, but another issue arrises with flex feeds -> the bounding box is a point instead of a box (at least for that feed)

@Alessandro100 Alessandro100 merged commit 56103e3 into main Apr 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GTFS Flex Feeds Detail Page: Detail Map showing nothing

4 participants