Skip to content

Commit 1cffb46

Browse files
authored
Merge pull request #5406 from HSLdevcom/keep-location-state-variables
DT-6918 - Fix unnecessary page reloads caused by errorBoundaryKey being removed from state
2 parents 5b87071 + 66ea0a7 commit 1cffb46

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

app/component/itinerary/ItineraryListContainer.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ function ItineraryListContainer(
6161
});
6262
const newLocation = {
6363
...match.location,
64-
state: { selectedItineraryIndex: index },
64+
state: {
65+
...match.location.state,
66+
selectedItineraryIndex: index,
67+
},
6568
};
6669
const basePath = `${getItineraryPagePath(
6770
params.from,
@@ -82,7 +85,10 @@ function ItineraryListContainer(
8285
} else {
8386
router.replace({
8487
...match.location,
85-
state: { selectedItineraryIndex: index },
88+
state: {
89+
...match.location.state,
90+
selectedItineraryIndex: index,
91+
},
8692
});
8793

8894
addAnalyticsEvent({

app/component/itinerary/ItineraryPage.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ export default function ItineraryPage(props, context) {
209209
});
210210
const newLocationState = {
211211
...location,
212-
state: { selectedItineraryIndex: 0 },
212+
state: {
213+
...location.state,
214+
selectedItineraryIndex: 0,
215+
},
213216
};
214217
const basePath = getItineraryPagePath(params.from, params.to);
215218
let pagePath = basePath;
@@ -1093,7 +1096,10 @@ export default function ItineraryPage(props, context) {
10931096

10941097
const newLocationState = {
10951098
...location,
1096-
state: { selectedItineraryIndex: index },
1099+
state: {
1100+
...location.state,
1101+
selectedItineraryIndex: index,
1102+
},
10971103
};
10981104
const pagePath = `${getItineraryPagePath(
10991105
params.from,

0 commit comments

Comments
 (0)