-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-17] [$500] Distance - Route Rerender and Waypoints grey out when add an empty stop #30176
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0133cf45668e492c7f |
Triggered auto assignment to @sakluger ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
Proposal by: @rakshitjain13 ProposalPlease re-state the problem that we are trying to solve in this issue.Route Rerender and Waypoints grey out when add an empty stop What is the root cause of that problem?In App/src/pages/iou/WaypointEditor.js Lines 136 to 138 in fcee207
In removeWaypoint function , we update the onyx state and set coordinates to null App/src/libs/actions/Transaction.ts Lines 104 to 155 in fcee207
Now in src/components/DistanceRequest/index.js we check if the route is present or not.
As in removeWaypoint we have removed route the below situation become true and leads to refetch App/src/components/DistanceRequest/index.js Lines 90 to 91 in fcee207
What changes do you think we should make in order to solve the problem?We should not to do any transaction on empty waypoint thus this can be done by removing these lines App/src/pages/iou/WaypointEditor.js Lines 136 to 138 in fcee207
Solution Video: https://github.com/Expensify/App/assets/54314936/2dcee9f5-a7fe-4c14-9867-60b25656c4f5 What alternative solutions did you explore? (Optional)We can cache the distance Coordinates and use that again if waypoints didn't change |
ProposalPlease re-state the problem that we are trying to solve in this issue.When adding an empty waypoint, existing waypoints flicker, and the route re-renders. What is the root cause of that problem?We are executing a transaction Onyx operation on waypoint removal here: App/src/pages/iou/WaypointEditor.js Lines 136 to 138 in 1c6b610
This piece of code was added in order to remove existing waypoints (when modifying them) by removing the address value. Therefore, it should not be removed. Inside this transaction action, we are checking if the removed waypoint was not empty. And if it wasn't – we remove the route from the transaction to trigger the route re-fetch. If we add an empty waypoint, the removed.length === 0 here, so the isRemovedWaypointEmpty is set to false: App/src/libs/actions/Transaction.ts Line 113 in 01016dc
Which results in clearing the transaction route here: App/src/libs/actions/Transaction.ts Lines 136 to 153 in 01016dc
Route re-render happens here because the route was removed: App/src/components/DistanceRequest/index.js Lines 86 to 91 in 844b3b9
What changes do you think we should make in order to solve the problem?We should add an early return in case no waypoint was removed in const removed = waypointValues.splice(index, 1);
+ if (removed.length === 0) {
+ return;
+ } App/src/libs/actions/Transaction.ts Lines 111 to 113 in 01016dc
This will ensure that we do not modify the route and do not do all the useless re-indexing calculations along with merging the transaction at the end of the function (as no waypoints were actually changed): App/src/libs/actions/Transaction.ts Line 154 in 01016dc
Result:screen-recording-2023-10-23-at-163106_tu1cjbMf.mp4What alternative solutions did you explore? (Optional)We can modify the logic: - const isRemovedWaypointEmpty = removed.length > 0 && !TransactionUtils.waypointHasValidAddress(removed[0] ?? {});
+ const isRemovedWaypointEmpty = removed.length === 0 || !TransactionUtils.waypointHasValidAddress(removed[0] ?? {}); This will stop the route from being removed, but the unnecessary |
ProposalPlease re-state the problem that we are trying to solve in this issue.Distance - Route Rerender and Waypoints grey out when add an empty stop What is the root cause of that problem?Let's see this logic App/src/pages/iou/WaypointEditor.js Lines 135 to 138 in 4430ae2
Currently, with this logic, the user can remove the waypoint by clearing the search input and clicking save button. Other way, this logic causes this bug because removeWaypoint function make the route is fetch again What changes do you think we should make in order to solve the problem?In here App/src/pages/iou/WaypointEditor.js Lines 135 to 138 in 4430ae2
We only run removeWaypoint if the user edits the old waypoint. If user click add stop button (create new waypoint) and leave the input empty and click save, we will don't run removeWaypoint function Note that: Current logic, we have Start point (index: 0) and finish point (index: 1), when clicking Add Stop the App will redirect to WaypointEditor with index: 2 So that if waypointIndex < _.size(allWaypoints) It mean that user are editing old waypoint. Update code like this
What alternative solutions did you explore? (Optional) |
Removing from the project since it's a very minor bug and more related to performance (preventing re-renders) |
@sakluger, @eVoloshchak Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Hey @eVoloshchak, looks like we have a few proposals to review, mind taking a look on Monday? |
I think we should proceed with @paultsimura's proposal 🎀👀🎀 C+ reviewed! |
Triggered auto assignment to @NikkiWines, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@eVoloshchak @NikkiWines Sorry for my late. But I want to propose a solution from another perspective ProposalPlease re-state the problem that we are trying to solve in this issue.Distance - Route Rerender and Waypoints grey out when adding an empty stop What is the root cause of that problem?I see that while user are online, the save button is useless and we need to hide it if user are online What changes do you think we should make in order to solve the problem?We should disable the save button if search input is empty. It also resolve this bug What alternative solutions did you explore? (Optional)We should hide the save button if user online. It also resolve this bug |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Oh, that's an interesting point about the I don't think we should completely hide the button, but I think it's more in line with our existing forms to disable that button when there's no value entered instead of allowing the user to "save" a value that doesn't exist. If the re-render issue still exists when using @sakluger @neil-marcellini @eVoloshchak, what do you think? |
@NikkiWines handling an empty waypoint was implemented specifically to allow removing existing waypoints (in edit mode) by entering an empty value. It's a handy feature, and disabling the "save" button for empty values will basically remove this feature, won't it? Screen.Recording.2023-10-30.at.22.45.40-compressed.mp4 |
Ah, good point @paultsimura, that's fair. Though, IMO, that's a bit of an odd flow to go through to remove a waypoint. But I wasn't involved in the design for this feature, so I'll lean on @neil-marcellini's expertise here to determine how we want to move forward. |
Just my 5 cents here: I have been using this feature a lot during development – it's much easier to remove the address & submit than to click three dots – remove the waypoint – confirm the popup. |
📣 @rakshitjain13 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
Thanks. The PR is ready for review: #30754 |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
Doesn't appear to be the root cause of the blocker 👍 |
@NikkiWines the PR is in production already, but the automation didn't update the [HOLD for payment] title, could you please check? 🙏 |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.97-7 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-17. 🎊 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:
|
Not sure why it didn't get updated, looks like everything was linked appropriately. Added all the requisite details |
@NikkiWines Friendly Bump |
@sakluger can you issue payments here please 🙇 |
Sorry for the delay! I've paid out the reporter and contributor. @eVoloshchak mind finishing the BZ checklist then requesting payment via manual request? |
|
Issue is missing a payment summary. |
@JmillsExpensify here you go! Summarizing payouts for this issue: Reporter: @rakshitjain13 $50 (paid via Upwork) |
$500 payment approved for @eVoloshchak based on comment above. |
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.89.3
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: @rakshitjain13
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697893765172309
Action Performed:
Expected Result:
Route should not get re-render and waypoints fields should not be grey out
Actual Result:
Route getting fetched again and waypoints fields become grey out
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Android: Native
Screen.Recording.2023-10-21.at.6.52.02.PM.1.mov
Android: mWeb Chrome
Screen.Recording.2023-10-21.at.6.55.29.PM.mov
iOS: Native
Screen.Recording.2023-10-21.at.6.48.09.PM.mov
iOS: mWeb Safari
Screen.Recording.2023-10-21.at.6.48.09.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-21.at.6.49.52.PM.mov
Screen.Recording.2023-10-21.at.6.48.09.PM.mov
Recording.5109.mp4
MacOS: Desktop
Screen.Recording.2023-10-21.at.6.46.15.PM.mov
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: