Skip to content

Commit 63acdc8

Browse files
committed
fix(mobile): only change screens on location change if not welcome screen
ibi-group/trimet-mod-otp#203
1 parent cf6a4f6 commit 63acdc8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/actions/form.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,14 @@ export function formChanged (oldQuery, newQuery) {
120120
dispatch(setMainPanelContent(null))
121121
}
122122

123-
// Clear the current search and return to search screen on mobile when either location changes
124-
if (isMobile() && (fromChanged || toChanged)) {
123+
// Clear the current search and return to search screen on mobile when
124+
// either location changes only if not currently on welcome screen (otherwise
125+
// when the current position is auto-set the screen will change unexpectedly).
126+
if (
127+
isMobile() &&
128+
(fromChanged || toChanged) &&
129+
otpState.ui.mobileScreen !== MobileScreens.WELCOME_SCREEN
130+
) {
125131
dispatch(clearActiveSearch())
126132
dispatch(setMobileScreen(MobileScreens.SEARCH_FORM))
127133
}

0 commit comments

Comments
 (0)