[$250] Composer disappears and wrong error position when track distance to McTest offline
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.45-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1833/folder/13176744/47211684/996805372 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Lenovo 80ES / Windows 10 Pro App Component: Other
Action Performed:
- Create account with no workspace
- Go offline
- Go to FAB> Distance track> Map
- Complete the stops with random characters> Next
- Select Manager McTest from Chose recipient page> Create expense
- Go online
Expected Result:
Error message should be positioned into report section and chat composer should be displayed
Actual Result:
Error message "Unexpected error..." is displayed above expense report and chat composer is lost
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] 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/bc1ceffe-edec-4a4e-a502-ee895985d8d2
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021986578186812285619
- Upwork Job ID: 1986578186812285619
- Last Price Increase: 2025-12-25
Issue Owner
Current Issue Owner: @aimane-chnaif
Triggered auto assignment to @trjExpensify (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.
Job added to Upwork: https://www.upwork.com/jobs/~021986578186812285619
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)
@IjaazA thanks for the proposal but I don't think your root cause is correct.
If you create offline distance request in already created DM, the issue doesn't happen.
Unexpected error creating this chat - I think we should find why this happens.
@aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...
Looking for proposals
@aimane-chnaif I have updated my proposal , can you check now ?
@IjaazA thanks. Have you ever tested your solution and confirmed it's working?
Looking for proposals
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@IjaazA just wondering if you've had a chance to look at @aimane-chnaif's Q on your proposal?
Looks like contributor removed proposal as it's not working.
Just found this issue. Taking a look.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!
@aimane-chnaif does it give to create with random locations on offline? It doesn't let me π§
@aimane-chnaif 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
@mukhrr duplicate waypoints issue is fixed in #75829. We can continue.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a distance request offline to Manager McTest (new DM), going online triggers an error but:
- The composer disappears
- The error shows in the wrong position (report header instead of expense preview)
What is the root cause of that problem?
When a money request fails, the client's failureData in buildOnyxDataForMoneyRequest sets errorFields.createChat on reports for any failure, but only when isNewChatReport is true:
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/actions/IOU.ts#L2037-L2043
This causes two issues:
-
Composer disappears:
canUserPerformWriteActionchecks forerrorFields.createChatand returnsfalse, hiding the composer:
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/ReportUtils.ts#L7276-L7278
-
Error in wrong position: The
createChaterror shows on the report header instead of the transaction. The actual API error (e.g., route/waypoint validation) is inresponse.onyxDataon the transaction, but the genericcreateChaterror takes precedence visually.
Why the issue doesn't happen with existing DM: The isNewChatReport condition is only true for new DMs (like Manager McTest on first contact). When creating a distance request in an already existing DM, isNewChatReport is false, so errorFields.createChat is never set in failureData, and the composer remains visible.
Additionally, TransactionPreviewContent has !isIOUSettled && shouldShowRBR which hides RBR on settled expenses - problematic when expense is optimistically "Paid" but API returns error:
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx#L371
What changes do you think we should make in order to solve the problem?
1. Remove errorFields.createChat from failureData in IOU.ts
The API provides specific error data via response.onyxData (transaction errors). Setting createChat error incorrectly blocks the composer and shows generic error.
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/actions/IOU.ts#L2037-L2043
Remove the errorFields.createChat spread for chat report, IOU report, and transaction thread report.
2. Add hasTransactionErrors to shouldShowRBR in TransactionPreviewUtils.ts
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/TransactionPreviewUtils.ts#L414
+ const hasTransactionErrors = !isEmptyObject(transaction?.errors) || !isEmptyObject(transaction?.errorFields?.route) || !isEmptyObject(transaction?.errorFields?.waypoints);
- const shouldShowRBR = hasAnyViolations || hasErrorOrOnHold || hasReportViolationsOrActionErrors || hasReceiptError(transaction);
+ const shouldShowRBR = hasAnyViolations || hasErrorOrOnHold || hasReportViolationsOrActionErrors || hasReceiptError(transaction) || hasTransactionErrors;
3. Add RBRMessage extraction from transaction errors in TransactionPreviewUtils.ts
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/TransactionPreviewUtils.ts#L275
+ const transactionErrorMessage = getLatestErrorMessage(transaction) || Object.values(getLatestErrorFieldForAnyField(transaction)).at(0);
+ if (!RBRMessage && transactionErrorMessage) {
+ RBRMessage = {text: transactionErrorMessage};
+ }
4. Remove !isIOUSettled from RBR display in TransactionPreviewContent.tsx
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx#L371
- {!isIOUSettled && shouldShowRBR && (
+ {shouldShowRBR && (
The !isIOUSettled check was intended to hide validation errors (like missing fields) on settled expenses since they're no longer actionable. However, the shouldShowRBR calculation already handles this appropriately - the hasErrorOrOnHold condition already filters out "on hold" status for settled expenses:
https://github.com/Expensify/App/blob/938fac59abc30bc1bfc1b2a2ad8c2eda402397f3/src/libs/TransactionPreviewUtils.ts#L412
For API submission errors (our case), we must show the error regardless of settlement status because the expense was optimistically marked "Paid" before the API returned an error - the user needs to see it failed.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@trjExpensify @aimane-chnaif 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!
@aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?
@TaduJR can you please share demo video?
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@TaduJR can you please share demo video?
Here @aimane-chnaif
https://github.com/user-attachments/assets/51d0d7e1-a0b0-4bfe-9785-9f279c8a2717
@aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@TaduJR are you able to reproduce on latest main?
Able to repo on staging @aimane-chnaif