-
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
[HOLD for payment 2023-11-22] [$500] Distance - Empty waypoint is not discarded but filled with Finish address in distance request #29886
Comments
Triggered auto assignment to @jliexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
This comment was marked as outdated.
This comment was marked as outdated.
ProposalPlease re-state the problem that we are trying to solve in this issue.When creating a Distance request with an empty stop in the middle, it is filled with the Finish address. What is the root cause of that problem?When submitting a Distance Request, we filter the valid waypoints that will be passed to the BE here: Line 649 in 39d2a84
However, we do not remove invalid (or empty) waypoints from the IOU Transaction before building the optimistic data here: Lines 622 to 637 in 39d2a84
We pass the existing Lines 509 to 520 in 3b86da6
As a result, we build and push an optimistic transaction with the following waypoints into Onyx (middle waypoint is empty): {
"comment": {
"type": "customUnit",
"customUnit": {
"name": "Distance"
},
"waypoints": {
"waypoint0": {
"lat": 10.4958294,
"lng": -66.884449,
"address": "Av. Casanova, Caracas, Distrito Capital, Venezuela"
},
"waypoint1": {},
"waypoint2": {
"lat": 10.5050318,
"lng": -66.84285249999999,
"address": "Los Palos Grandes, Caracas 1060, Miranda, Venezuela"
}
}
}
} Then, the {
"comment": {
"waypoints": {
"waypoint0": {
"lat": 10.4958294,
"lng": -66.884449,
"address": "Av. Casanova, Caracas, Distrito Capital, Venezuela"
},
"waypoint1": {
"lat": 10.5050318,
"lng": -66.84285249999999,
"address": "Los Palos Grandes, Caracas 1060, Miranda, Venezuela"
}
}
}
} We would expect here that the As a result, we have a transaction with first 2 waypoints from API response, and third - the stale one from the optimistic transaction: {
"comment": {
"waypoints": {
"waypoint0": {
"lat": 10.4958294,
"lng": -66.884449,
"address": "Av. Casanova, Caracas, Distrito Capital, Venezuela"
},
"waypoint1": {
"lat": 10.5050318,
"lng": -66.84285249999999,
"address": "Los Palos Grandes, Caracas 1060, Miranda, Venezuela"
},
"waypoint2": {
"lat": 10.5050318,
"lng": -66.84285249999999,
"address": "Los Palos Grandes, Caracas 1060, Miranda, Venezuela"
}
}
}
} What changes do you think we should make in order to solve the problem?We should clean up the existing transaction's waypoints in Onyx before building the optimistic data. First, create a new function in function cleanupWaypoints(transactionID: string): Promise<void> {
const transaction = allTransactions[transactionID];
const existingWaypoints = TransactionUtils.getWaypoints(transaction) ?? {};
const validWaypoints = TransactionUtils.getValidWaypoints(existingWaypoints, true);
const updatedWaypoints: WaypointCollection = lodashReduce(existingWaypoints, (result, value, key) => ({
...result,
// Explicitly set the non-existing waypoints to null so that Onyx can remove them
[key]: validWaypoints[key] ?? null,
}), {});
return Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {
comment: {
waypoints: updatedWaypoints,
},
});
} This function executes the same Second, clean up the existing transaction before calling the const createDistanceRequest = useCallback(
(selectedParticipants, trimmedComment) => {
+ Transaction.cleanupWaypoints(props.iou.transactionID).then(() => {
IOU.createDistanceRequest(...);
+ });
},
[props.report, props.iou.created, props.iou.transactionID, props.iou.category, props.iou.tag, props.iou.amount, props.iou.currency, props.iou.merchant, props.iou.billable],
); App/src/pages/iou/steps/MoneyRequestConfirmPage.js Lines 190 to 207 in 39d2a84
Third, remove the waypoints cleanup here, as it will already be done in the transaction: Line 649 in 39d2a84
Result:distance-empty-waypoint.movUpdate:An important benefit of my solution compared to the one posted below (which was my alternative solution) is that it fixes not only an empty waypoint issue but also the issue when the same waypoint is added multiple times in a row: Bug demoScreen.Recording.2023-10-24.at.19.21.16.mp4What alternative solutions did you explore? (Optional)Alternatively, we can modify the UX behavior when adding waypoints: replace the first empty waypoint (if there is one) instead of adding a waypoint to the end and keeping an empty waypoint in the middle. However, this needs to be approved by the UX, since this behavior is different from the expected one (as described in the issue). I can provide code for this approach as well (changes in https://github.com/Expensify/App/blob/main/src/pages/iou/WaypointEditor.js), but did not include it here to keep the already long proposal a bit cleaner. |
This doesn't seem like an issue to me? If you don't enter a cc @hayata-suenaga @neil-marcellini for your thoughts here |
@jliexpensify The root cause I described above causes a worse scenario. Please see the recording: trim.3B049C91-7C93-403C-AFB3-0EA9AF37B62B.MOV |
@jliexpensify the part marked in red below should not appear. so many regression from Wave 5 😢 Thank you for handling this 🙇 |
Got it, thanks for confirming @hayata-suenaga - going to apply the |
Job added to Upwork: https://www.upwork.com/jobs/~017934cb2ae94a72d9 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Changing UX behavior, we decided to make the add button show up when there are 2+ valid waypoints. What is the root cause of that problem?Changing UX behavior, we decided to make the add button show up when there are 2+ valid waypoints. What changes do you think we should make in order to solve the problem?
and only display the add button if numberOfFilledWaypoints >=2
This function is created to add a stop point to the middle of the start and finish point. With the new UX behavior, It becomes redundant. App/src/pages/iou/WaypointEditor.js Line 151 in 5b5d465
|
@cubuspl42 we have a proposal above, any thoughts? |
We have 2 of them, starting with this one: #29886 (comment) |
I appreciate the detailed and deep root cause analysis! Not for the first time. On the other hand, the proposal by @DylanDylann is less invasive, as it uses the already existing logic. Is it possible that the local I'm still trying to wrap my head around this. |
@cubuspl42 My solution is small change, I tested and It works well |
@cubuspl42 the proposal from @DylanDylann was my alternative approach, but I did not include the actual code (my bad) to keep the proposal cleaner and it was different from the "Expected Behavior" described in the issue:
Please also check this part of my proposal, this is the main reason why I suggest going with the actual Onyx cleanup:
But we can combine both the cleanup and the UX change. The thing is, we are doing the waypoints cleanup here anyway: Line 649 in 39d2a84
My solution just suggests moving this cleanup to the beginning of the |
Don't agree this point:
Note that: @paultsimura edited his alternative solution after I posted proposal |
@DylanDylann Not the part we're discussing |
@paultsimura Your proposal is solid, but next time don't be afraid to go for the best / most reasonable solution. We quite often modify the app behavior (UX) slightly when solving issues, and it goes without UX approval. And, most importantly, the "Expected result" provided in the issue description should also be looked at with a healthy dose of scepticism. At times, it can be challenged and discussed. |
After giving it a thought, I'll suggest going with @DylanDylann, as they provided a simple change that solves the issue in practice while making an app behave reasonably. C+ reviewed 🎀 👀 🎀 |
My PR's ready, I'm just waiting to be assigned to this issue. |
📣 @cubuspl42 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @paultsimura 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Thanks. The PR is ready: #31017 |
Hi @cubuspl42 - let me know what partial compensation you'd like to offer and I'll write it into my Payment Summary. Thanks! |
@jliexpensify I was thinking about $250 for @DylanDylann. It can be taken from my share. |
Thanks! Assuming there are no regressions/bonuses, here's what the Payment Summary would look like:
|
@jliexpensify this issue is dupe of #28477 this has been told many times but nothing has been done to close this issue and open the #28477 |
@jo-ui this is definitely not a dupe of #28477. In fact, during the investigation of this issue, a separate bug was found, but we decided not to fix it because it would be fixed in #28477
I can't find any mention of this issue in #28477 – could you please point us to where it was mentioned as a dupe? |
@paultsimura sorry for the confusion, I wrote the comment in the wrong issue sorry again |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.99-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-11-22. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
|
There's some issues with Upworks atm, going to try paying later today |
Everyone is now paid and job is closed! |
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.3.86-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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:
Since the waypoint in Step 4 is empty, it should be discarded automatically when the distance request is created
Actual Result:
The empty waypoint is now filled with the address in Finish point
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6242005_1697648681894.20231018_192459__1_.mp4
MacOS: Desktop
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: