Skip to content

Commit

Permalink
Merge pull request #1191 from opentripplanner/itineraryview-url-param…
Browse files Browse the repository at this point in the history
…-mobile-only

Avoid setting ui_itineraryView on desktop
  • Loading branch information
binh-dam-ibigroup authored Apr 16, 2024
2 parents 0c6cada + f051a2a commit 700d36e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/actions/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,20 @@ export function handleBackButtonPress(e) {
*/
export function setItineraryView(value) {
return function (dispatch, getState) {
const urlParams = coreUtils.query.getUrlParams()
if (coreUtils.ui.isMobile()) {
const urlParams = coreUtils.query.getUrlParams()

// If the itinerary value is changed,
// set the desired ui query param (even if LIST, so it replaces the current value)
// and store the current view as previousItineraryView.
if (value !== getItineraryView(urlParams)) {
urlParams.ui_itineraryView = value
// If the itinerary value is changed,
// set the desired ui query param (even if LIST, so it replaces the current value)
// and store the current view as previousItineraryView.
if (value !== getItineraryView(urlParams)) {
urlParams.ui_itineraryView = value

dispatch(setUrlSearch(urlParams))
dispatch(setUrlSearch(urlParams))
dispatch(settingItineraryView(value))
}
} else {
// Don't set/use the ui_itineraryView in desktop mode.
dispatch(settingItineraryView(value))
}
}
Expand Down

0 comments on commit 700d36e

Please sign in to comment.