From fa64f325ced691a5331ff0ed524d001cbc077698 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Tue, 14 Mar 2023 18:03:37 -0400 Subject: [PATCH 1/2] fix(gtfs-search): Display GTFS routes in search results. --- lib/gtfs/components/gtfs-search.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/gtfs/components/gtfs-search.js b/lib/gtfs/components/gtfs-search.js index 6a8e26faa..2ba917908 100644 --- a/lib/gtfs/components/gtfs-search.js +++ b/lib/gtfs/components/gtfs-search.js @@ -153,11 +153,14 @@ class GtfsSearch extends Component { stops && stopOptions.push(...stops.map(s => _entityToOption(s, feed))) routes && routeOptions.push( ...routes - // Remove specified entity ids (route ids in this case) to exclude, except the current value. - .filter(route => - !excludedEntityIds.includes(route.route_id) || - // (Extended type checks are for flow validation.) - (route.route_id === (typeof currentOption === 'object' ? currentOption && currentOption.value : currentOption)) + // Keep routes whose ids are not excluded and that are not the one selected in the dropdown. + .filter(route => { + const isExcluded = excludedEntityIds && excludedEntityIds.includes(route.route_id) + const isSameAsCurrent = + // (Extended type checks are for flow validation.) + route.route_id === (typeof currentOption === 'object' ? currentOption && currentOption.value : currentOption) + return !isExcluded && !isSameAsCurrent + } ) .map(r => _entityToOption(r, feed)) ) From 0ae39ac7871576ef83bd73826499b38d94b1574c Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Tue, 21 Mar 2023 08:54:13 -0400 Subject: [PATCH 2/2] refactor(gtfs-search): Exclude null route ids from search. --- lib/gtfs/components/gtfs-search.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/gtfs/components/gtfs-search.js b/lib/gtfs/components/gtfs-search.js index 2ba917908..ad73fa6a8 100644 --- a/lib/gtfs/components/gtfs-search.js +++ b/lib/gtfs/components/gtfs-search.js @@ -155,10 +155,13 @@ class GtfsSearch extends Component { ...routes // Keep routes whose ids are not excluded and that are not the one selected in the dropdown. .filter(route => { - const isExcluded = excludedEntityIds && excludedEntityIds.includes(route.route_id) + const { route_id: routeId } = route + if (routeId === null || routeId === undefined) return false + + const isExcluded = excludedEntityIds && excludedEntityIds.includes(routeId) const isSameAsCurrent = // (Extended type checks are for flow validation.) - route.route_id === (typeof currentOption === 'object' ? currentOption && currentOption.value : currentOption) + routeId === (typeof currentOption === 'object' ? currentOption && currentOption.value : currentOption) return !isExcluded && !isSameAsCurrent } )