From ab975f8cd8b1b97e08ae3a147bd9fcc2d25d34b9 Mon Sep 17 00:00:00 2001 From: Andreas Helms Date: Thu, 23 Jan 2025 15:18:16 +0100 Subject: [PATCH] fix(itinerary-list): itineraries are not selectable --- app/component/ItineraryListContainer.js | 4 ++-- app/util/queryUtils.js | 6 +++--- test/unit/util/queryUtils.test.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/component/ItineraryListContainer.js b/app/component/ItineraryListContainer.js index dd269038f8..9fc823a7a9 100644 --- a/app/component/ItineraryListContainer.js +++ b/app/component/ItineraryListContainer.js @@ -95,7 +95,7 @@ class ItineraryListContainer extends React.Component { } else { this.context.router.replace({ ...this.context.match.location, - state: { summaryPageSelected: index }, + state: { selectedItineraryIndex: index }, pathname: `${getItineraryPagePath( this.props.params.from, this.props.params.to, @@ -146,7 +146,7 @@ class ItineraryListContainer extends React.Component { }); const newLocation = { ...this.context.match.location, - state: { summaryPageSelected: index }, + state: { selectedItineraryIndex: index }, }; const basePath = `${getItineraryPagePath( this.props.params.from, diff --git a/app/util/queryUtils.js b/app/util/queryUtils.js index 1294f38cb4..af4bb78e60 100644 --- a/app/util/queryUtils.js +++ b/app/util/queryUtils.js @@ -19,8 +19,8 @@ import { addViaPoint } from '../action/ViaPointActions'; */ export const resetSelectedItineraryIndex = loc => { const location = cloneDeep(loc); - if (location.state && location.state.summaryPageSelected) { - location.state.summaryPageSelected = 0; + if (location.state && location.state.selectedItineraryIndex) { + location.state.selectedItineraryIndex = 0; } if (location.pathname) { @@ -144,7 +144,7 @@ export const updateItinerarySearch = ( ...location, state: { ...location.state, - summaryPageSelected: 0, + selectedItineraryIndex: 0, }, pathname: getPathWithEndpointObjects( origin, diff --git a/test/unit/util/queryUtils.test.js b/test/unit/util/queryUtils.test.js index c49b97ae87..be01f3f402 100644 --- a/test/unit/util/queryUtils.test.js +++ b/test/unit/util/queryUtils.test.js @@ -79,14 +79,14 @@ describe('queryUtils', () => { }); describe('resetSelectedItineraryIndex', () => { - it('should reset state.summaryPageSelected to 0', () => { + it('should reset state.selectedItineraryIndex to 0', () => { let location = { state: { - summaryPageSelected: 3, + selectedItineraryIndex: 3, }, }; location = utils.resetSelectedItineraryIndex(location); - expect(location.state.summaryPageSelected).to.equal(0); + expect(location.state.selectedItineraryIndex).to.equal(0); }); it('should not modify other state properties', () => {