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

Taxes - Inconsistency in leading 0 in saving tax rate #39082

Closed
6 tasks done
lanitochka17 opened this issue Mar 27, 2024 · 5 comments
Closed
6 tasks done

Taxes - Inconsistency in leading 0 in saving tax rate #39082

lanitochka17 opened this issue Mar 27, 2024 · 5 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 27, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.57-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #38733

Action Performed:

Precondition:

  • User is admin of Collect workspace
  1. Go to staging.new.expensify.com
  2. Go to Profile > Workspaces > Collect workspace
  3. Go to Taxes > Add rate > Value
  4. Enter 01 and save it
  5. Click Value again
  6. Note that 0 is preserved
  7. Click on any existing tax rate
  8. Click Value > Enter 01 > Save
  9. Click Value again
  10. Note that 0 is not preserved

Expected Result:

There should be consistency whether leading 0 in tax rate should be preserved

Actual Result:

In Step 5, 0 is preserved in adding tax rate flow
In Step 9, 0 is not preserved in edit existing tax rate flow

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

Add any screenshot/video evidence

Bug6428827_1711552910550.20240327_231650.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 27, 2024
Copy link

melvin-bot bot commented Mar 27, 2024

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@shahinyan11
Copy link

shahinyan11 commented Mar 27, 2024

Proposal

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

Taxes - Inconsistency in leading 0 in saving tax rate

What is the root cause of that problem?

Here In the AmountSelectorModal we are directly passing the value from the props to useSate and so this code only works while the component is mounted . And and when the props value is updated, the currentValue will not be updated accordingly. And the thing is that the value of the props is updated differently ( see here ) than the currentValue of the state ( see here )

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

Add below code here

useEffect(()=>{
    setValue(value)
}, [value])

What alternative solutions did you explore? (Optional)

Add new handleAmountChange function in AmountSelectorModal component which will update the value in the same way as it is done while pressing save here. And use it instead setValue

const handleAmountChange =(val: string)=>{
    setValue(String(Number(val)))
}

What alternative solutions did you explore? (Optional)

Remove this line and use value from props everywhere instead currentValue

@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2024
@dylanexpensify
Copy link
Contributor

reviewing now!

@melvin-bot melvin-bot bot removed the Overdue label Apr 2, 2024
@dylanexpensify
Copy link
Contributor

Could not repro, and low value

@shahinyan11
Copy link

@dylanexpensify It still reproducible

Screen.Recording.2024-04-03.at.00.43.57.mov

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
Projects
None yet
Development

No branches or pull requests

3 participants