From da29ad94668a3d2c23cc562f0ca3e5a4c07dd0c7 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Thu, 30 May 2024 11:05:02 -0400 Subject: [PATCH 1/3] explicitly save sessionId when starting over --- lib/reducers/create-otp-reducer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/reducers/create-otp-reducer.js b/lib/reducers/create-otp-reducer.js index a2c39ddc2..45d4bdf80 100644 --- a/lib/reducers/create-otp-reducer.js +++ b/lib/reducers/create-otp-reducer.js @@ -153,6 +153,10 @@ export function getInitialState(userDefinedConfig) { ...(transitModeSettings || []) ] + const sessionId = new URLSearchParams( + document.location.hash.split('#/')[1] + ).get('sessionId') + return { activeSearchId: 0, config, @@ -164,7 +168,9 @@ export function getInitialState(userDefinedConfig) { type: config.itinerary?.defaultSort || 'BEST' } }, - initialUrl: window.location.pathname, + initialUrl: `${window.location.pathname}${ + sessionId ? `?sessionId=${sessionId}` : '' + }`, lastActionMillis: 0, location: { currentPosition: { From cc61f840bc42041be5dd694e231fde4d1ca6edef Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Thu, 30 May 2024 11:05:55 -0400 Subject: [PATCH 2/3] safer hash check --- lib/reducers/create-otp-reducer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reducers/create-otp-reducer.js b/lib/reducers/create-otp-reducer.js index 45d4bdf80..e692d97a4 100644 --- a/lib/reducers/create-otp-reducer.js +++ b/lib/reducers/create-otp-reducer.js @@ -154,7 +154,7 @@ export function getInitialState(userDefinedConfig) { ] const sessionId = new URLSearchParams( - document.location.hash.split('#/')[1] + document.location.hash.split('#/')?.[1] ).get('sessionId') return { From 06ae19cec9bbd59eccf24a2e11b854f2699af2c0 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Mon, 3 Jun 2024 15:06:40 -0400 Subject: [PATCH 3/3] address pr feedback --- lib/reducers/create-otp-reducer.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/reducers/create-otp-reducer.js b/lib/reducers/create-otp-reducer.js index e692d97a4..69b33584d 100644 --- a/lib/reducers/create-otp-reducer.js +++ b/lib/reducers/create-otp-reducer.js @@ -16,7 +16,7 @@ import { getISOLikeTimestamp } from '../util/state' import { MainPanelContent, MobileScreens } from '../actions/ui-constants' const { filterProfileOptions } = coreUtils.profile -const { getDefaultQuery } = coreUtils.query +const { getDefaultQuery, getUrlParams } = coreUtils.query const { getItem } = coreUtils.storage const { getUserTimezone } = coreUtils.time @@ -153,9 +153,7 @@ export function getInitialState(userDefinedConfig) { ...(transitModeSettings || []) ] - const sessionId = new URLSearchParams( - document.location.hash.split('#/')?.[1] - ).get('sessionId') + const sessionId = new URLSearchParams(getUrlParams()).get('sessionId') return { activeSearchId: 0,