-
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 issue #34615] Display waypoint error in confirm page and detail page #30621
Conversation
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there 👋, I'm jumping in to give an early review.
src/libs/ReportUtils.js
Outdated
* @returns {Boolean} | ||
*/ | ||
function hasDistanceTransactionRouteErrors(iouReportID) { | ||
const distanceTransactions = getDistanceTransactions(iouReportID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more efficient to check if it's a distance transaction within the some callback, that way we don't have to loop through all transactions once we find one with a route error. Also I think we can just check if it has a route error since only distance transactions can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same way that we do in hasMissingSmartscanFields
function so I think that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update both functions to be more performant. I don't see why we should purposefully do more work than necessary.
We can just do
return _.some(allTransactions, (transaction) => TransactionUtils.hasRouteError(transaction));
src/languages/en.ts
Outdated
@@ -592,6 +592,7 @@ export default { | |||
genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later', | |||
genericEditFailureMessage: 'Unexpected error editing the money request, please try again later', | |||
genericSmartscanFailureMessage: 'Transaction is missing fields', | |||
genericWaypointFailureMessage: 'Distance request has route error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you get a copy check for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for asking for a copy check on the issue 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good thanks for the updates. I still want to see a more efficient check for the route error, also waiting on the copy check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates! There are still some things to patch up.
The copy check is done and it sounds like we can use an error message that already exists in our translation files. |
Thanks for your feedback, I updated. |
@neil-marcellini We don't have a translation like this. And |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your latest updates look good thank you. I tested and I don't see where we display genericWaypointFailureMessage
. Do you know if we display it at all? If not we could use the error message from the route directly, in order to check if the report has any errors.
Instead of Please select a valid waypoint
, the error message should be Please enter a valid address
. That's very close to what was suggested for the copy and we already have a translation key for it.
Finally, I encountered a bug when editing a previously created distance request and adding an invalid address for a stop.
Screen.Recording.2023-11-03.at.11.36.42.AM.mov
I updated.
I also saw this bug. I think this came from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to update the error message where it's displayed to use the suggested copy text.
@@ -211,6 +218,8 @@ function MoneyRequestView({report, betas, parentReport, policyCategories, should | |||
shouldShowRightIcon={canEdit && !isSettled} | |||
titleStyle={styles.flex1} | |||
onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DISTANCE))} | |||
brickRoadIndicator={hasErrors && hasRouteError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} | |||
error={hasErrors && hasRouteError ? lodashValues(ErrorUtils.getLatestErrorField(transaction, 'route'))[0] : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should show Please enter a valid address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This display for special request so I think we should display correctly the route error that is returned from BE. We also display this in MoneyRequestConfirmList
.
@dukenv0307 the text shown for the error simply needs to be changed. ProblemThe error message under the distance row is SolutionThe error message under the distance row should be |
@neil-marcellini Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but there are lint errors @dukenv0307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, pending C+ testing
will complete review by tomorrow |
@dukenv0307 please merge main |
@situchan Updated. |
As logic was moved, can you please retest? One platform test is fine |
@situchan What do you mean, I moved the logic from old file to the current confirm page now and tested locally. |
yeah I meant that. Logic was moved from old file to new file |
@situchan I tested it locally. |
@dukenv0307 After online, address is reverted back to valid ones and still shows error Full repro video: Screen.Recording.2023-12-19.at.7.04.56.PM.mov |
Another bug: Edit distance was closed automatically and Screen.Recording.2023-12-19.at.7.10.01.PM.mov |
@situchan This error is returned from BE since we update waypoint with invalid address. |
@situchan This is out of scope of this issue, because when we offline we generate another transaction thread reportID and with invalid address, when we go back from online this transaction is invalid and it's not stored from BE. |
@neil-marcellini what do you think above issues? |
This is a bug, but it's related to the issue for handling offline geocoding errors in general. [DISTANCE] LOW: Handle errors with geocoding for offline distance requests. We had a pre-design in Slack a while ago about the desired UX, although it was focused on the creation flow. I think we should follow that plan here too, and we wouldn't get any benefit from merging this until it's implemented as we want it. I hope you're ok with working on this more @dukenv0307. For this flow here's the desired behavior.
|
@dukenv0307 @situchan Thanks for your hard work on this. I know we found some bugs that feel a bit out of scope, but I think we're better off fixing them all at once vs one at a time. That way it's more clear what the desired UX is. Let's use this as our tracking issue [DISTANCE] LOW: Handle errors with geocoding for offline distance requests. I know we'll need some backend changes too, and that issue is currently un-assigned. I hope to pick it up some time after vacation (after January 15). We could add on to this PR and use it to implement the frontend changes, or just close this and start from scratch later. I would recommend the former however. You might be able to recruit another backend engineer in #wave5-free-submitters to help while I'm out. |
@dukenv0307 @situchan do you know what backend changes @neil-marcellini is referring to? I'd be happy to take them on |
I will re-work on this after money request flow is refactored completely. cc @neil-marcellini @situchan. |
This has been handing around for a while, and the backend updates haven't been picked up yet, so going to close this. You can always reopen later. |
Details
Display waypoint error in confirm page and detail page
Fixed Issues
$ #29783
PROPOSAL: #29783 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-1.mov
Android: mWeb Chrome
chrome.mov
iOS: Native
ios.mov
iOS: mWeb Safari
safari.mov
MacOS: Chrome / Safari
web-1.mov
MacOS: Desktop
desktop-1.mov