[$300] Expense - Incorrect Total amount is shown after deleting split expense
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: V9.2.61-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 App Component: Money Requests
Action Performed:
- Go to
- Login with new gmail account
- Create a new workspace
- Open workpace chat
- Create a empty report
- Add a manual expense ₹4
- Open the expense and tap more
- Create a new manual expense for ₹4
- Open the expense and tap more
- Select Split and complete the flow
- Open the second split expense
- Tap header - delete the expense
Expected Result:
The report Total should be properly calculated to reflect the new amount after deleting the split expense.
Actual Result:
The report Total is incorrect.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [x] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/9d80b173-7b8a-4499-96a9-91fb50ef1e43
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021993040190076850888
- Upwork Job ID: 1993040190076850888
- Last Price Increase: 2025-12-10
- Automatic offers:
- situchan | Reviewer | 109835299
Issue Owner
Current Issue Owner: @robertjchen
Triggered auto assignment to @brianlee-expensify (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.
@jponikarchuk i rephrased your "expected result" and "actual result" sections in the OP, but i think it still needs more clarification:
- what is the incorrect system message?
- what is the expected/correct system message?
@brianlee-expensify The total amount was initially ₹6 but briefly changed to ₹8. The user did not modify the amount; they only deleted a split expense. However, the system message incorrectly indicates that the amount was changed.
Job added to Upwork: https://www.upwork.com/jobs/~021993040190076850888
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)
@situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
asking in slack regarding next steps
asking for repro first
Reproduce, MacOS Monterey / Chrome, Xiaomi Redmi Note 10 / Android 12mWeb, Xiaomi Redmi Note 10 / Android 12, Web v9.2.71-2
https://github.com/user-attachments/assets/275fb838-946c-40bf-9375-5f79845caacb
https://github.com/user-attachments/assets/03ea972c-11a2-48ee-a1fd-7961281dd4cf
https://github.com/user-attachments/assets/425c4bb5-5cc8-417d-aa97-c3bb014ff560
interesting, thanks @m-natarajan - adding some notes here:
- 1st recording @ 1:48 - amount is correct now, but the system message is still incorrect (should be about deleting the split expense, not changing the amount)
- 2nd recording @ 1:48 - total amount and currency are both incorrect (should be INR 8.00, not UAH 3.76). confirmed that changing currency preference at workspace level did not apply changes as hoped for the report "Expense Report 2025-12-03"
- 2nd recording @ 2:15 - deleting one of the split expenses still did not update the total amount and currency (should be INR 6.00, not UAH 3.76) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
- 3rd recording @ 2:27 - deleting one of the split expenses temporarily showed the correct total amount and currency (INR 6.00), but immediately changed to the incorrect amount (INR 8.00) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
also tested myself on prod, the total amount is incorrect
will verify with engineering about the system message in this slack thread
@brianlee-expensify 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
update on Dec 4: verified with engineering about the system message in this slack thread - it is indeed correct that it should be about changing the amount, not deleting the split expense @jponikarchuk
rephrasing what's correct/incorrect below from this previous comment:
- 1st recording @ 1:48 - amount is correct now, but the system message is still incorrect (should be about deleting the split expense, not changing the amount)
- both the amount and system message are correct now
- 2nd recording @ 1:48 - total amount and currency are both incorrect (should be INR 8.00, not UAH 3.76). confirmed that changing currency preference at workspace level did not apply changes as hoped for the report "Expense Report 2025-12-03"
- confirming whether changing currency at workspace level only applies to new expenses created from that point on (slack thread)
- 2nd recording @ 2:15 - deleting one of the split expenses still did not update the total amount and currency (should be INR 6.00, not UAH 3.76) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
- system message is correct
- confirming whether changing currency at workspace level only applies to new expenses created from that point on (slack thread)
- 3rd recording @ 2:27 - deleting one of the split expenses temporarily showed the correct total amount and currency (INR 6.00), but immediately changed to the incorrect amount (INR 8.00) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
- system message is correct, but the total amount is still incorrect
updating the title and original body of this GH to reflect these changes
@situchan @brianlee-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Awaiting proposals
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
awaiting proposals
Upwork job price has been updated to $300
I'm Maciej from Callstack - expert contributor group. The issue is confirmed, I can take this job.
📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
Not overdue
@brianlee-expensify Eep! 4 days overdue now. Issues have feelings too...
@leshniak any updates here?
Sorry for the lack of updates. I have few clues:
- the issue disappear after refreshing the app (the total amount looks fine),
- there is probably some discrepancy between optimistic and success data in the communication with API.
I am currently analyzing IOU.ts file and updateSplitTransactions function in reverse split operation flow, but the amount of things going on here is a bit overwhelmed for me right now - I'm just started with the project. I've asked the Callstack team for help.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After adding an expense to the report, then splitting it and deleting one of its parts, the total amount of the report does not update.
What is the root cause of that problem?
According to the logic in updateSplitTransactions() from IOU.ts, deleting the second-to-last part of a split expense triggers the WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION API method, which converts the last remaining part into a regular expense. The API response returns, among other things, a new total value for the report, but it is not updated to reflect the deleted parts of the split expense (in other words, it likely still includes the value of the original expense from before the split operation). On the other hand, the unheldTotal value is set correctly.
The total value in the optimistic UI variant is set correctly, but then it gets overwritten by the value from the backend.
The problem does not occur after reopening the report.
What changes do you think we should make in order to solve the problem?
The backend logic for WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION should be updated so the returned report total is correct after a split is reverted.
What alternative solutions did you explore? (Optional)
If the total value at the time WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION is called via the API is correct, then a resynchronization with the backend should be performed in a different or additional way.
@leshniak @situchan @brianlee-expensify this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!
@leshniak Eep! 4 days overdue now. Issues have feelings too...
Agree with @leshniak's analysis. The issue is in backend.
Optimistic total amount is correct and becomes wrong when online. As seen in this video, that incorrect amount is corrected again only when open the report and go online.
https://github.com/user-attachments/assets/fb961941-8026-4612-95ec-2d0d87952b16
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @robertjchen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@leshniak please check this video (around 00:14s). I tested on 2 devices.
https://github.com/user-attachments/assets/92f17164-2af3-4904-a7bf-703df4437068
It's interesting that total amount is displayed correctly on device A after deleting expense on device B. Can you please try to find the root cause?