Skip to content
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

[$250] Expense - Leading zeros are not removed when returning to amount input page #43243

Closed
6 tasks done
kavimuru opened this issue Jun 7, 2024 · 34 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jun 7, 2024

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.80-9
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4592856
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:

  1. Go to staging.new.expensify.com
  2. Go to FAB > Submit expense > Manual.
  3. Enter many zeros, then any digit > Next.
  4. Return to amount input page via back button.

Expected Result:

The leading zeros will be removed.

Actual Result:

The leading zeros are not removed.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6504348_1717705798824.20240607_041959.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d1b0565d440e64fb
  • Upwork Job ID: 1799101354337638448
  • Last Price Increase: 2024-06-07
  • Automatic offers:
    • hungvu193 | Reviewer | 102719101
    • abzokhattab | Contributor | 102719103
Issue OwnerCurrent Issue Owner: @hungvu193
@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jun 7, 2024
Copy link

melvin-bot bot commented Jun 7, 2024

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link

melvin-bot bot commented Jun 7, 2024

Triggered auto assignment to @techievivek (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

github-actions bot commented Jun 7, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@kavimuru
Copy link
Author

kavimuru commented Jun 7, 2024

@techievivek FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@kavimuru
Copy link
Author

kavimuru commented Jun 7, 2024

We think this bug might be related to #wave-collect - Release 1

@neonbhai
Copy link
Contributor

neonbhai commented Jun 7, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Expense - Leading zeros are not removed when returning to amount input page

What is the root cause of that problem?

This happens as in the Submit Expense flow we access the IOU amount page from here:

<IOURequestStepAmount route={route} />

This does not have the shouldKeepUserInput prop passed to it.

Since the prop is false by default:

shouldKeepUserInput = false,

The last param here is false, leading to the amount not being formatted.

IOU.setMoneyRequestAmount(transactionID, amountInSmallestCurrencyUnits, currency || CONST.CURRENCY.USD, shouldKeepUserInput);

What changes do you think we should make in order to solve the problem?

Since <IOURequestStepAmount is only accessed from the IOURequestStartPage, we can simply have the prop true by default.

shouldKeepUserInput = false,

shouldKeepUserInput = false, 

Alternatively

  • We can pass shouldKeepUserInput here

  • We should also consider renaming the prop to shouldFormatUserInput to better reflect what its doing

@trjExpensify
Copy link
Contributor

Have we identified the PR on staging that caused this bug?

@luacmartins
Copy link
Contributor

I think this PR caused the regression

@techievivek
Copy link
Contributor

Not a backend blocker.

@sakluger
Copy link
Contributor

sakluger commented Jun 7, 2024

I don't think this needs to be a deploy blocker, since it doesn't block the user from doing anything, it's just a display bug in a single flow.

cc @trjExpensify in case you disagree.

@sakluger sakluger added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jun 7, 2024
@techievivek
Copy link
Contributor

Yeah, it doesn't break anything related to making request so we can remove the blocker label.

@techievivek techievivek added the External Added to denote the issue can be worked on by a contributor label Jun 7, 2024
@melvin-bot melvin-bot bot changed the title Expense - Leading zeros are not removed when returning to amount input page [$250] Expense - Leading zeros are not removed when returning to amount input page Jun 7, 2024
Copy link

melvin-bot bot commented Jun 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01d1b0565d440e64fb

Copy link

melvin-bot bot commented Jun 7, 2024

📣 @Rakshh! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@Har103
Copy link

Har103 commented Jun 7, 2024

Just saw this on UW
And I might give a stupid solution.

Why are we not checking user input at the time of input (like on change event) and removing the leading zeros or any non numaric character at that time.
A small sterilization function should not cause any performance issues.

Copy link

melvin-bot bot commented Jun 7, 2024

📣 @Har103! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@jainilparikh
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.

When the user enters leading 0's in the input, these extra 0's are not removed.

What is the root cause of that problem?

Issue causing PR (https://github.com/Expensify/App/pull/40062/commits)

The PR introduces a new flag, called shouldKeepUserInput (in the component IOURequestStepAmount) which determines if the user input needs to be sanitised or not.

The above mentioned flag is NOT provided a value when the IOURequestStepAmount is rendered inside the IOURequestStartPage page here:

https://github.com/Expensify/App/blob/main/src/pages/iou/request/IOURequestStartPage.tsx#L157

What changes do you think we should make in order to solve the problem?

Set the flag to False

 <TopTab.Screen name={CONST.TAB_REQUEST.MANUAL}>
                                        {() => (
                                            <IOURequestStepAmount
                                                shouldKeepUserInput = {false}
                                                route={route}
                                            />
                                        )}
</TopTab.Screen>

Validated that the above solution works locally.

@hungvu193
Copy link
Contributor

@abzokhattab Can you take a look at this issue, it seems to have stem from #40062

Thanks for proposals everyone. But I think we should wait for this comment first.

@hungvu193
Copy link
Contributor

hungvu193 commented Jun 11, 2024

@abzokhattab Can you take a look at this issue, it seems to have stem from #40062

little bump @abzokhattab on this comment

@abzokhattab
Copy link
Contributor

Thank you @hungvu193 sure i will work on it

@hungvu193
Copy link
Contributor

Hold for #43243 (comment)

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

📣 @hungvu193 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jun 13, 2024

📣 @abzokhattab 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@techievivek
Copy link
Contributor

Assigning it to @abzokhattab based on #43243 (comment)

@hungvu193
Copy link
Contributor

@techievivek I think the original C+ will handle this one right?

@sakluger
Copy link
Contributor

sakluger commented Jun 14, 2024

Good call @hungvu193. I'll reassign @eVoloshchak as the C+.

@sakluger sakluger assigned eVoloshchak and unassigned hungvu193 Jun 14, 2024
@sakluger
Copy link
Contributor

Hey @abzokhattab - do you have a proposal or PR to fix this issue yet?

@abzokhattab
Copy link
Contributor

isn't this already the expected behavior according to #35797 (comment) and #34894 (comment)?

cc @dangrous @eVoloshchak

@dangrous
Copy link
Contributor

So yeah this is currently expected behavior - to maintain user input in this flow. I could see us making an exception for leading zeros, but I don't think this should count as a regression.

Basically our reasoning was that it's confusing if what you put in changed when you go back to it, and we do all the parsing afterwards. Again, this can be open for discussion, but shouldn't be a regression.

We could also go the other route that Square Cash (and maybe others) take, and just disallow leading zeros from the beginning.

@melvin-bot melvin-bot bot added the Overdue label Jun 18, 2024
@sakluger
Copy link
Contributor

Thanks for clarifying @dangrous. I agree that we don't need to count this as a regression, but we should change the behavior to disallow leading zeros.

@sakluger
Copy link
Contributor

You know what - since this is the expected behavior at the moment, I'm going to close the issue for now. We can reopen later or open a new issue if we want to change the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests