Open
Description
It might be considered a bug that we are not overwriting the time setting when the back button is pressed in order to have the query settings match the active search. Currently, the current query is kept separate from the active search, even if the active search is showing results for a different set of query params. Let's consider a user making a transit search
- First the user searches with a leave time of 9am (search A)
- The user changes the time to 10am and clicks Plan trip (search B)
- Next, the user clicks the back button, which causes the active search to switch from B to A, but the query time in the form still shows 10am.
This may require some code in the componentDidUpdate
method similar to the below. Or, perhaps we should introduce a helper method to get the currentQuery
that checks the searches list in the app state before defaulting to state.otp.currentQuery
.
// componentDidUpdate for call-taker/date-time-options.js
if (time !== prevProps.time) {
const date = moment().startOf('day').format('YYYY-MM-DD')
const parsedTime = moment(date + 'T' + this.state.timeInput, SUPPORTED_TIME_FORMATS)
const dateTime = moment(`${date} ${time}`)
if (parsedTime.format('H:mm') !== dateTime.format('H:mm')) {
this._updateTimeInput(dateTime)
}
}