Skip to content

Commit

Permalink
Merge pull request #900 from stadtnavi/fix/itinerary-selected-index
Browse files Browse the repository at this point in the history
fix(itinerary-list): itineraries are not selectable
  • Loading branch information
andreashelms authored Jan 27, 2025
2 parents c068139 + ab975f8 commit c1d7dce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/component/ItineraryListContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/util/queryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -144,7 +144,7 @@ export const updateItinerarySearch = (
...location,
state: {
...location.state,
summaryPageSelected: 0,
selectedItineraryIndex: 0,
},
pathname: getPathWithEndpointObjects(
origin,
Expand Down
6 changes: 3 additions & 3 deletions test/unit/util/queryUtils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit c1d7dce

Please sign in to comment.