-
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
Add useEffect to select default tax code #43519
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
@aldo-expensify May I know do I need to wait for the backend change to do the test? |
I don't think it is necessary, the optimistic data should make it looks like it is working fine unless you logout / login |
@aldo-expensify I finished frontend (optimistic update) test and it works well for me, see two recordings in the Web browser section of my checklist. I also can repro the negative tax amount issue in the transaction thread as you mentioned here. It seems I got red dot in the Tax field while you didn't. Let me know if I should continue testing with other platforms or waiting for subsequent updates, thank you. |
@aldo-expensify looks like this is just held on the clarification above |
I resolved the conflicts and pushed a fix for the taxes showing negative. I don't think taxes will ever be negative, so I added a App/src/components/MoneyRequestConfirmationListFooter.tsx Lines 253 to 254 in f6eddbf
just like we do for the amount: App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx Lines 571 to 572 in f6eddbf
With this change, the If you follow the testing steps it is possible that you end up with the report loading forever: I think this is unrelated and is happening because of regressions coming from this PR: #40168 (I already fixed a very similar regression)
@eh2077 I'm not sure about this validation error, I haven't seen it while testing. It may be an unrelated bug? 🤷 Considering the skeleton loading forever problem, I'm not sure if you will be able to test correctly. Can you give it a try and see if works for you? |
@eh2077 could you please check this comment above when you have moment, thanks! |
@MonilBhavsar Sure, I just tried to re-test it. I found two issues this time
|
This is unrelated and seems to happen in
I pushed a fix for the negative tax, I missed that. About the validation error, I still don't see it, and it is probably unrelated. |
I'll re-test it today |
@aldo-expensify Kindly help to resolve the conflicts when you get a chance. |
@eh2077 this is ready for review again, please review asap to avoid more delays / conflicts |
@aldo-expensify Can you please clean up debugging console logs? Other than that code changes look good to me. Just realised that free trials of my exiting accounts have been ended. I have applied for free trials here. I'll complete the checklist asap once my account is granted with free trial. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / Safari0-web.mp4MacOS: Desktop |
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.
LGTM and tested well
@tylerkaraszewski 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] |
@MonilBhavsar this is ready for internal review (friendly bump) |
Oops sorry I missed it. I was focussed on fireroom. I'll surely get to this tomorrow morning - the first thing |
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! Some minor comments. Doing some tests
? CurrencyUtils.convertToDisplayString(Math.abs(updatedTransaction?.taxAmount), transactionCurrency) | ||
: CurrencyUtils.convertToDisplayString(Math.abs(transactionTaxAmount ?? 0), transactionCurrency); |
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.
Sorry, why this change?
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.
The tax amount is negative in some cases and we never want to display it as a negative number
(transaction.taxAmount !== undefined && | ||
previousTransactionAmount === transaction.amount && | ||
previousTransactionCurrency === transaction.currency && | ||
previousCustomUnitRateID === customUnitRateID && |
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.
Why we added customUnitRateID?
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.
Because if the rate changes we should recalculate the tax amount because it may have changed
IOU.setMoneyRequestTaxRate(transactionID, defaultTaxCode ?? ''); | ||
}, [customUnitRateID, policy, previousCustomUnitRateID, previousTransactionCurrency, previousTransactionModifiedCurrency, shouldShowTax, transaction, transactionID]); | ||
|
||
// A flag for showing the billable field |
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 comment looks off from the code below it
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.
Probably a bad conflict resolution, I'll remove it.
Okay looks good and works fine! @eh2077 checklist is failing somehow, could you please a final look. Thanks! |
@MonilBhavsar I replied your questions and removed the comment that was added by mistake. Ready for review again. |
Bump @MonilBhavsar, It would be nice if this doesn't get conflicts again |
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! 🚀
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.0.22-0 🚀
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.0.22-1 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 9.0.22-9 🚀
|
Re-implementation of #42126
Details
Needs: https://github.com/Expensify/Auth/pull/10987 and https://github.com/Expensify/Web-Expensify/pull/42115
Fixed Issues
$ #42114
PROPOSAL:
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 methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-06-11.at.7.37.13.PM.mov
MacOS: Desktop