Skip to content

Conversation

@binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Sep 17, 2020

If there is an error while saving a new or existing trip, the trip settings screen will close after the user dismisses the error message. I find this annoying, and this PR prevents the trip settings screen from closing in such situations. In some cases, you want the user to be able to make changes and let them attempt to change again.

To test:

@binh-dam-ibigroup binh-dam-ibigroup changed the title Do not leave screen if there is an error saving… Do not close trip settings screen on error saving trip. Sep 17, 2020
@evansiroky evansiroky removed their assignment Sep 22, 2020
const savedTrip = this.props.monitoredTrips.find(trip => {
const tripQueryParams = qs.parse(trip.queryParams.split('?')[1])
return tripQueryParams.ui_activeSearch === activeSearchId
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach seems flimsy. I would prefer that this logic be contained within the action -- that would remove all of this inference that is being applied here. I think the routing logic for these handlers (goToTripPlanner, goToSavedTrips, etc.) should also be contained within those actions.

Copy link
Member

@landonreed landonreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we ought to move this logic to the actions. That would remove the need for the somewhat flimsy checks and instead just check the result of the fetch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_handleSaveTrip does not need to exist (just use _updateMonitoredTrip). Also, _updateMonitoredTrip does not need to be async (no need to await createOrUpdateUserMonitoredTrip).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated in 3fd0a0a along with missing import in actions/user.

Copy link
Member

@landonreed landonreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's a lot simpler. Nice work. Just one final condition for approval (see comment).

@binh-dam-ibigroup binh-dam-ibigroup merged commit 1b9d84e into dev Oct 12, 2020
@binh-dam-ibigroup binh-dam-ibigroup deleted the dont-exit-if-save-fails branch October 12, 2020 16:28
@landonreed
Copy link
Member

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants