Skip to content

Commit 700395d

Browse files
committed
fix: fix location prop when derived from active search
1 parent 99261bf commit 700395d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/components/form/location-field.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { addLocationSearch, getCurrentPosition } from '../../actions/location'
1919
import { findNearbyStops } from '../../actions/api'
2020
import { distanceStringImperial } from '../../util/distance'
2121
import { formatStoredPlaceName } from '../../util/map'
22+
import { getActiveSearch } from '../../util/state'
2223

2324
class LocationField extends Component {
2425
static propTypes = {
@@ -565,9 +566,12 @@ function createTransitStopOption (stop, onSelect, isActive) {
565566
// connect to redux store
566567

567568
const mapStateToProps = (state, ownProps) => {
569+
const activeSearch = getActiveSearch(state.otp)
570+
const query = activeSearch ? activeSearch.query : state.otp.currentQuery
571+
const location = query[ownProps.type]
568572
return {
569573
config: state.otp.config,
570-
location: state.otp.currentQuery[ownProps.type],
574+
location,
571575
user: state.otp.user,
572576
currentPosition: state.otp.location.currentPosition,
573577
sessionSearches: state.otp.location.sessionSearches,

0 commit comments

Comments
 (0)