Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(apiV2): Don't perform query/UI changes on invalid mode selection #1222

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
ignore_words_list: MapPin
# skip git, yarn, pixel test script and HAR file, and all i18n resources.
# Also, the a11y test file has a false positive and the ignore list does not work
# see https://github.com/opentripplanner/otp-react-redux/pull/436/checks?check_run_id=3369380014
Expand Down
8 changes: 5 additions & 3 deletions lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,10 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
// This is likely due to the fact that BICYCLE_RENT is treated as a transit submode.
const combinations = modes ? [baseQuery] : generateCombinations(baseQuery)

if (combinations.length === 0) {
return RoutingQueryCallResult.INVALID_MODE_SELECTION
}

dispatch(
routingRequest({
activeItinerary,
Expand Down Expand Up @@ -1171,9 +1175,7 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
dispatch(updateOtpUrlParams(state, searchId))
}

return combinations.length === 0
? RoutingQueryCallResult.INVALID_MODE_SELECTION
: RoutingQueryCallResult.SUCCESS
return RoutingQueryCallResult.SUCCESS
}
}

Expand Down
Loading