-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Distance-In receipt, finish address shown is different from the address entered #31613
Comments
Job added to Upwork: https://www.upwork.com/jobs/~019b70146b213c00f1 |
Triggered auto assignment to @conorpendergrast ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Distance-In receipt, finish address shown is different from the address entered What is the root cause of that problem?In this case, the optimistic data waypoints will be: A->A->B->B When we merge data from BE to ONYX we are using MERGE method, so that the result will be: A->B->B->B (Because BE only return 2 waypoints so the App only update 2 first waypoints to ONYX and retain 2 last ones) What changes do you think we should make in order to solve the problem?IDEA: We need to clean the waypoints in optimistic data, If the user enters A->A->B->B, we only should update A->B to ONYX Detail: Currently We don't have logic to prevent users from clicking the next button when they enter two consecutive same endpoints Note that in App/src/components/DistanceRequest/index.js Line 180 in bf2d545
we should check if _.size(validatedWaypoints) < _.size(waypoints) we will prevent user from submitting
Also need to update here App/src/components/DistanceRequest/index.js Line 220 in bf2d545
In this function App/src/components/DistanceRequest/index.js Line 147 in bf2d545
we also add a message like "please remove duplicated consecutive waypoints" if _.size(validatedWaypoints) < _.size(waypoints)
We also prevent user going to next page by deeplink when they enter 2 consecutive same waypoints App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js Line 98 in bf2d545
In here we also need to add condition like we did in DistanceRequest Page ( _.size(validatedWaypoints) < _.size(waypoints) )
What alternative solutions did you explore? (Optional)When receiving data waypoint from BE, we need to update totally (using SET instead of MERGE) |
I also think this is dupe of #29895 or #28477. |
ProposalPlease re-state the problem that we are trying to solve in this issue.The order of waypoints is not preserved correctly when a money request is created with manual route including duplicate consecutive waypoints. A simplified reproduction case can include just three waypoints:
The resulting request receipt will show different waypoints:
What is the root cause of that problem?The list of waypoints differ between the optimistic transaction data and the saved transaction data. These waypoints are saved in an object instead of an array which causes the merge process to mangle the route when the final collection has fewer keys than the original. Specifically, for my example above, the original waypoint includes three waypoints of which two are duplicated: {
"waypoint0": { "lat": 37.7749295, "lng": -122.4194155, "address": "San Francisco, CA, USA", "name": "San Francisco" },
"waypoint1": { "lat": 37.7749295, "lng": -122.4194155, "address": "San Francisco, CA, USA", "name": "San Francisco" },
"waypoint2": { "lat": 32.715738, "lng": -117.1610838, "address": "San Diego, CA, USA", "name": "San Diego" }
} However, the waypoints are deduplicated before saving via the {
"waypoint0": { "lat":37.7749295, "lng":-122.4194155, "address":"San Francisco, CA, USA", "name":"San Francisco" },
"waypoint1": { "lat":32.715738, "lng":-117.1610838, "address":"San Diego, CA, USA", "name":"San Diego" }
} Finally, these values are merged without deleting the extraneous waypoint property, resulting in the last waypoint being duplicated. {
"waypoint0": { "lat": 37.7749295, "lng": -122.4194155, "address": "San Francisco, CA, USA", "name": "San Francisco" },
"waypoint1": { "lat": 32.715738, "lng": -117.1610838, "address": "San Diego, CA, USA", "name": "San Diego" },
"waypoint2": { "lat": 32.715738, "lng": -117.1610838, "address": "San Diego, CA, USA", "name": "San Diego" }
} It looks like this incorrect merging behaviour has been in place since #26591 which initially introduced waypoint correction. What changes do you think we should make in order to solve the problem?The following multi-part proposal is designed to remove complexity from the overloaded Part 1: Refactor waypoint utils into granular helpers The existing implementation of
These use cases can be served by removing
Note that the first two functions are composable and would be used to implement the third. Part 2: Stop removing repeated waypoints Removing repeated waypoints from a report seems like an unintended side effect of #26591 reusing Instead, we can replace the call in this line to use the new Part 3: Remove empty waypoints earlier in the workflow The workflow to create a distance-based request includes multiple steps:
The waypoints are currently cleaned at Step 6; however, this is later in the workflow than is ideal. Instead, empty waypoints should be removed in Step 4, when the "Next" button is first tapped. This can be accomplished by expanding the callback Note: this is where we would also fix the initial waypoint merging issue. This can be fixed by setting unused waypoint keys to Part 4: Present an error message to users when duplicate waypoints exist (Optional) An error message is presented to users when editing a money request. This same error message should be displayed when creating a request. What alternative solutions did you explore? (Optional)
|
📣 @tobyjsullivan! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
Closing in favour of #29895, thanks for the context! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.1-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @
Action Performed:
Expected Result:
The waypoints entered while creating distance request must be displayed in receipt.
Actual Result:
In receipt page, the finish address shown is different from the address entered while creating distance request.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6285167_1700553234943.duplicate.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: