Repository navigation
Fix 0% tax rate flash when deselecting a category on an expense - #101572
Conversation
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@situchan friendly bump |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safaribefore: Screen.Recording.2026-10-02.at.7.49.01.PM.movafter: Screen.Recording.2026-10-02.at.7.51.32.PM.mov |
|
@situchan bump |
…00591 # Conflicts: # src/libs/TransactionUtils/index.ts
| @@ -403,7 +403,9 @@ function getUpdatedTransaction({ | |||
| if (Object.hasOwn(transactionChanges, 'category') && typeof transactionChanges.category === 'string') { | |||
| updatedTransaction.category = transactionChanges.category; | |||
| const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = getCategoryTaxDetails(transactionChanges.category, transaction, policy, getCurrencyDecimals); | |||
There was a problem hiding this comment.
Code optimization:
If !transactionChanges.category, no need to run getCategoryTaxDetails.
There was a problem hiding this comment.
Moved getCategoryTaxDetails inside the guard so it doesn't run when we skip.
Regression reviewI found one likely regression, in split flows. The single-expense edit flow from Expense-Deselecting category shows 0% tax rate briefly and changes to previous rate looks safe. Split drafts now save the old category's tax. The split flows use
Here is how to reproduce it in a split:
Before this PR, the split saved the workspace default tax. Now it keeps 10%. The PR comment says the server response "immediately overwrites" the tax, but that isn't true for these flows. Fix: Scope the guard to the server-backed edit path, or confirm which behavior product wants for splits. Then add a unit test either way. Other findings and what I checked
view run · no recording available |
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
@MelvinBot review |
| // On a server backed edit, clearing the category leaves the stored tax rate untouched, so predicting a | ||
| // change here only writes a rate that the response immediately overwrites. Split drafts have no such | ||
| // response and send whatever tax the draft holds, so they keep recalculating. | ||
| if (transactionChanges.category || isSplitTransaction) { |
There was a problem hiding this comment.
Is split case really regression from this PR?
ReviewNo blocking issues. The latest commit fixes the split problem from my earlier review. Was split really a regression? Yes, in the first commit (
The latest commit adds Other checks
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 JS00001 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.4-0 🚀
|
|
No help site update is needed. This PR fixes a brief optimistic flash of a 0% tax rate when you clear an expense's category. The saved tax rate doesn't change, so no existing article sentence becomes incorrect. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.4-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixed Issues
$ #100591
PROPOSAL:
Tests
Ten Percent(10%) under Taxes.Ten Percent • 10%.$25.00manual expense with categoryAdvertising.Ten Percent (10%)and Tax amount is$2.27.Advertising.Ten Percent (10%)/$2.27without flashing to0%orTax exempt.Five Percent(5%) as the default tax rate forBenefits, then change the expense category toBenefits. Verify the tax updates toFive Percent (5%)without flashing.Offline tests
QA Steps
Same as tests
Verify that no errors appear in the JS console
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_hybrid.mp4
Android: mWeb Chrome
android_mWeb.mp4
iOS: Native
ios_hybrid.mp4
iOS: mWeb Safari
ios_mWeb.mp4
MacOS: Chrome / Safari
web_chrome.mp4