Repository navigation
Analyzing is incorrectly shown after creating expense and enabling auto categorizing offline - #102626
Conversation
…to categorizing offline
|
@MelvinBot Why are the tests failing? |
|
Two checks fail: Caused by this PR
Not caused by this PR
The |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safarioutput.mp4 |
|
Bug: In the split flow, the split expense is displayed with the "Analyzing..." label indefinitely. Steps:
Screen.Recording.2026-10-01.at.00.55.19.mov |
| cardName: existingTransaction?.cardName, | ||
| cardNumber: existingTransaction?.cardNumber, | ||
| ...(existingTransaction?.iouRequestType ? {iouRequestType: existingTransaction.iouRequestType} : {}), | ||
| wasAutoCategorizeEnabledOnCreation: policy?.autoCategorizeNewExpenses !== false, |
There was a problem hiding this comment.
Callers that pass existingTransaction without a policy (e.g. SplitExpenseItems.ts, SplitExpenses.ts) flip a recorded false back to true.
Would falling back to existingTransaction?.wasAutoCategorizeEnabledOnCreation when policy is missing be safer?
| // Check if manual request is being created | ||
| if (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { | ||
| return true; | ||
| return transaction.wasAutoCategorizeEnabledOnCreation !== false; |
There was a problem hiding this comment.
Prefer === true here?
buildOptimisticTransaction always writes an explicit true or false for wasAutoCategorizeEnabledOnCreation, so === true would read more directly than !== false — what do you think?
There was a problem hiding this comment.
@truph01 Keeping !== false so a pending expense created before this field existed still shows "Analyzing...". A missing value means the setting defaulted to on. New expenses already store true in that case.
|
@truph01 I think the issue #102626 (comment) is pre-existing then we should fix in a follow-up |
|
@truph01 All yours, can you please create an issue for #102626 (comment)? |
|
@truph01 all good? |
| cardNumber: existingTransaction?.cardNumber, | ||
| ...(existingTransaction?.iouRequestType ? {iouRequestType: existingTransaction.iouRequestType} : {}), | ||
| // Splits rebuild this expense without a policy. A missing policy would otherwise read as enabled and erase a recorded false. | ||
| wasAutoCategorizeEnabledOnCreation: policy ? policy.autoCategorizeNewExpenses !== false : existingTransaction?.wasAutoCategorizeEnabledOnCreation !== false, |
There was a problem hiding this comment.
Readers all check !== false, so the true branch writes a no-op field to every transaction — could we drop it with ...(policy?.autoCategorizeNewExpenses === false ? {wasAutoCategorizeEnabledOnCreation: false} : {})?
|
@jasperhuangg All yours! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 jasperhuangg 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/jasperhuangg in version: 9.5.4-0 🚀
|
|
No help site update needed. This bug fix stops the "Analyzing" label from showing on an expense created offline before Auto-categorize was turned on, and no article in |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.4-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixed Issues
$ #102604
PROPOSAL:
Tests
Precondition:
Disable Auto-categorize new expenses in Categories settings.
Verify that: In Step 7, after creating expense and enabling Auto-categorize new expenses offline, Analysing will not appear on Category field because expense is already created before Auto-categorize new expenses is enabled.
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-30.at.14.34.23.mov