-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 App # 28618] Request & send money - User is redirected to Amount page from Amount page from deep link #29972
Comments
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue. |
Triggered auto assignment to @joekaufmanexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.If a user clicks on a link to request money (eg: https://staging.new.expensify.com/request/new), enter an amount, click next and then proceed to click on a link to send money (eg: https://staging.new.expensify.com/send/new), the amount will be pre-populated but after clicking next, it will render the amount screen again. The same happens if you invert the order of the links (send money first and then request money) What is the root cause of that problem?The problem is that a single IOU object is used for both send and request money screens. When sending money, the id is IOU.navigateToNextPage(iou, iouType, report); In this case, The first thing this method does is check if the ID of the stored IOU is different than the current IOU being created/edit, and if it is, it will reset the the stored IOU, triggering a screen re-render, which will re-render the amount screen: const moneyRequestID = `${iouType}${report.reportID || ''}`;
const shouldReset = iou.id !== moneyRequestID;
// If the money request ID in Onyx does not match the ID from params, we want to start a new request
// with the ID from params. We need to clear the participants in case the new request is initiated from FAB.
if (shouldReset) {
resetMoneyRequestInfo(moneyRequestID);
} What changes do you think we should make in order to solve the problem?This problem does not happen when you use the FAB to initiate Send or Receive money. That's because each of these buttons will first call function startMoneyRequest(iouType, reportID = '') {
resetMoneyRequestInfo(`${iouType}${reportID}`);
Navigation.navigate(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID));
} This will stop this issue from happening. When clicking on links, we don't have the opportunity to reset before it loads, causing this problem. My proposal is to call // reset money request info when screen is first loaded
// but only if there's a divergence between current iou and url parameters
useEffect(() => {
if (iou.id === `${iouType}${reportID}`) {
return;
}
resetMoneyRequestInfo();
}, []); This will resolve the inconsistence while still allowing user to reload the screen and continue right where it was left off (we will not reset because the url parameters still match current IOU. What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
ProposalPlease re-state the problem that we are trying to solve in this issue.User redirected from amount page to amount page (instead of participants page) when using deep link What is the root cause of that problem?The problem occurs when there is a mismatch between Lines 2863 to 2871 in eb5fec2
But the resetMoneyRequestInfo function resets all the iou properties including iou.amount (to 0). So in the MoneyRequestParticipantsPage this lines of code will navigate it back because iou.amount is 0.App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js Lines 97 to 99 in eb5fec2
What changes do you think we should make in order to solve the problem?We need to update
Lines 2863 to 2871 in eb5fec2
to
` 6.New.Expensify.mp4What alternative solutions did you explore? (Optional) |
Proposalfrom: @cooldev900 Please re-state the problem that we are trying to solve in this issue.If a user clicks on a link to request money (eg: https://staging.new.expensify.com/request/new), enter an amount, click next and then proceed to click on a link to send money (eg: https://staging.new.expensify.com/send/new), the amount will be pre-populated but after clicking next, it will render the amount screen again. What is the root cause of that problem?The problem is that a single IOU object is used for both send and request money screens, and the id of IOU object will become Lines 124 to 141 in 8dba113
App/src/pages/iou/steps/MoneyRequestConfirmPage.js Lines 295 to 311 in 302cebf
App/src/pages/iou/steps/MoneyRequestConfirmPage.js Lines 295 to 311 in 302cebf
Lines 1259 to 1279 in 8dba113
Lines 2513 to 2519 in 8dba113
After clicking request button in MoneyRequestConfirmPage, the id of IOU object will be empty so shouldReset becomes true due to
could be another reason in next refresh. App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js Lines 92 to 99 in 302cebf
What changes do you think we should make in order to solve the problem?Calling the resetMoneyRequestInfo in IOU.js let a user get back to report page automatically but when we visit request/new page directly, we need to take an account if the iou.id is set or not to avoid getting back to amount page again.
What alternative solutions did you explore? (Optional)N/A |
Proposal |
ProposalPlease re-state the problem that we are trying to solve in this issueIf a user clicks on a link to request money (eg: https://staging.new.expensify.com/request/new), enter an amount, click next and then proceed to click on a link to send money (eg: https://staging.new.expensify.com/send/new), the amount will be pre-populated but after clicking next, it will render the amount screen again. What is the root cause of that problem?The issue here is that the same IOU object
is used for both sending and requesting money but with opposite id's i.e, When you send money, it's labeled with the Which results : iou.id = 'send' and iouType = 'request'. Lines 2863 to 2871 in 18acd82
which creates the new request What changes do you think we should make in order to solve the problem?We need to reset the IOU if id is not matched through App/src/pages/iou/steps/NewRequestAmountPage.js Lines 96 to 121 in 18acd82
like
What alternative solutions did you explore? (Optional)NA POCPOC.mov |
Def seems like a bug. @Ollyws thoughts on the above proposals? |
Will have a look at this one today. |
Great, ty! |
Thanks for the proposals everyone. @barros001, there was a previous PR that did exactly what you are suggesting but it was reverted due to causing multiple regressions, so I think we best avoid that solution. @FitseTLT The problem is that we're calling resetMoneyRequestInfo when we navigate to the next page due to the fact that @cooldev900 Still considering yours, will need to do a little more testing. @maxconnectAbhi Correct me if I'm wrong but I'm not sure how your proposal would work as you're suggesting we modify code inside the isEditing block, which isn't being called here as far as I can see unless we're editing. |
@Ollyws Got it. That PR does look pretty similar to what I tried locally, so yeah, let's avoid that. What about my alternative solution? The idea is to simply reset the IOU every time the screen is first loaded. It's similar to what useEffect(() => {
resetMoneyRequestInfo();
}, []); Also, we would do it on |
@Ollyws No I am not modifying code inside isEditing block , Its in else condition. |
@Ollyws - do you think the bug report here is derivative/has the same root cause as this issue? |
They are related in that they're both due to a mismatch of the Onyx data and the route param, but I'm not sure the solutions would overlap. This one seems to be because we never clear the Onyx data when navigating via deeplink and are therefore left with stale data which doesn't match the route param, so clearning it initially when we navigate via deeplink (to match what we do when we navigate via the menu) seems to be the correct solution here. Whereas from what I can see #30060 seems to be because we set the Onyx data for the request type when we navigate to the confirmation step, and it's retained when we navigate back. |
Ongoing discussion about solutions |
@Ollyws curious if you think we're close to being able to select any of these proposals? |
Still pending more discussion on proposals |
All good, and sounds good! |
Well, it was a lot faster than I thought it would be, my account was verified already and I applied for the job via Upwork. |
@barros001 offer sent for $500! Please let us know once the PR is ready for review. |
PR is ready for review. Just pending attaching video for Android native, will do as soon as I can get it to run on my dev machine. |
I'll put this issue on hold for #28618, since that refactor should fix this. |
Just to note: According to section 19 of the process doc, in this situation payment is due for the C+ and contributor. Thanks. |
Yep, I agree! We'll wait and see if that PR fixes this issue. If it does, we'll still issue payment and close this out. If not, we'll proceed with the PR. |
Held |
Same |
Still held |
Other PR was deployed to staging today. Going to retest there. |
Restested, and now when I go to I think this is because the request refactor changed the format of request URLs. @luacmartins thoughts on fixing this? Perhaps that could be a good pivot for this issue. And instead of going to the above page (where there is no option to leave), we could go to |
Problem here is the following: Lines 247 to 298 in 2d8523a
App/src/libs/Navigation/linkingConfig.ts Lines 393 to 410 in 2d8523a
App/src/pages/iou/MoneyRequestSelectorPage.js Lines 123 to 139 in 2d8523a
The To me looks like we're in this transition phase where this route/screen has to exist because Update the should show check to this: shouldShow={!IOUUtils.isValidMoneyRequestType(iouType) || !isAllowedToCreateRequest || [CONST.IOU.TYPE.REQUEST, CONST.IOU.TYPE.SPLIT].includes(iouType)} And get rid of this App/src/pages/iou/MoneyRequestSelectorPage.js Lines 111 to 141 in 2d8523a
This will make it so |
Ah, actually I think we just fixed that here. |
Chatted with @luacmartins and there's nothing else we need to fix here. I just need to pay $500 to each of @barros001 and @Ollyws and then close this out. Will take care of that tomorrow! |
@barros001 $500 sent and contract ended! |
@Ollyws offer sent for $500! |
Accepted, thanks! |
Paid! Closing as this is all set. |
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.87-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:
Issue found when executing PR #29655
Action Performed:
) to any chat,
3, Click on the link above.
).
Expected Result:
User will be redirected to the next step of the Request money/Send money process
Actual Result:
The process is looped. Instead of proceeding to the next step, user lands on the enter amount page again
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
Bug6242961_1697721243249.20231019_195657.mp4
MacOS: Desktop
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: