Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear distance when save waypoint #34779

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp
// Clear the existing route so that we don't show an old route
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually sorry, can we update this comment or add a new one nearby explaining why we're clearing out distance, just so it's easy to understand / remember why this is needed in the future? 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added comment, please check again

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thanks @dukenv0307 - do you mind adding the comment to the distance: null you added as well? Seems you added the comment to another place we set distance to null, which is also useful!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Beamanator Thanks for your comment, please check again.

Copy link
Contributor

Choose a reason for hiding this comment

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

Haha we must clear distance a lot -> You added distance: null on line 76, but added comments on line 150 & 260 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Omg, this is my mistake. I just added a comment to all distance: null

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries! Apparently we clear distance in many places hahaha now we both know!

routes: {
route0: {
// Clear the existing distance to recalculate next time
distance: null,
geometry: {
coordinates: null,
},
Expand Down Expand Up @@ -146,6 +148,7 @@ function removeWaypoint(transaction: Transaction, currentIndex: string, isDraft:
// Clear the existing route so that we don't show an old route
routes: {
route0: {
// Clear the existing distance to recalculate next time
distance: null,
geometry: {
coordinates: null,
Expand Down Expand Up @@ -255,6 +258,7 @@ function updateWaypoints(transactionID: string, waypoints: WaypointCollection, i
// Clear the existing route so that we don't show an old route
routes: {
route0: {
// Clear the existing distance to recalculate next time
distance: null,
geometry: {
coordinates: null,
Expand Down
Loading