You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Split - Error splitting expense after submitting a distance expense #43798
Version Number: 1.4.84-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team
@zanyrenney FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Please re-state the problem that we are trying to solve in this issue.
There is error splitting expense after submitting a distance expense
What is the root cause of that problem?
We call OpenReport API in withWritableReportOrNotFound if the reportID doesn't exist in report data. So in the create flow, OpenReport API is called every time we open a step in this flow.
When we navigate to the waypoint page, we pass the reportID param as report?.reportID which will be undefined when we create a new request via FAB, and then OpenReport API is called with reportID is undefined which will store the report data with key report_undefined in Onyx.
After that, if we create a split expense via FAB, the problem appears here, existingChatReportID is undefined which leads existingSplitChatReport is not empty because in Onyx we have report data with key report_undefined as mentioned above and then we don't create a new optimistic report which makes the SplitBillAndOpenReport fails.
To prevent this bug happening in the feature, we should check reportID of existingSplitChatReport is empty or not instead of checking existingSplitChatReport
Activity
melvin-bot commentedon Jun 15, 2024
Triggered auto assignment to @zanyrenney (
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.lanitochka17 commentedon Jun 15, 2024
@zanyrenney FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
lanitochka17 commentedon Jun 15, 2024
We think that this bug might be related to #vip-split
truph01 commentedon Jun 17, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
There is error splitting expense after submitting a distance expense
What is the root cause of that problem?
We call
OpenReportAPI inwithWritableReportOrNotFoundif thereportIDdoesn't exist in report data. So in the create flow,OpenReportAPI is called every time we open a step in this flow.App/src/pages/iou/request/step/withWritableReportOrNotFound.tsx
Line 69 in 1e0831e
When we navigate to the waypoint page, we pass the
reportIDparam asreport?.reportIDwhich will beundefinedwhen we create a new request via FAB, and thenOpenReportAPI is called withreportIDisundefinedwhich will store the report data with keyreport_undefinedin Onyx.App/src/pages/iou/request/step/IOURequestStepDistance.tsx
Line 185 in 1e0831e
After that, if we create a split expense via FAB, the problem appears here,
existingChatReportIDisundefinedwhich leadsexistingSplitChatReportis not empty because in Onyx we have report data with keyreport_undefinedas mentioned above and then we don't create a new optimistic report which makes theSplitBillAndOpenReportfails.App/src/libs/actions/IOU.ts
Line 3751 in 1e0831e
What changes do you think we should make in order to solve the problem?
OpenReportAPI in the edit flow to prevent none exist report can be stored in Onyx in the create flowApp/src/pages/iou/request/step/withWritableReportOrNotFound.tsx
Lines 65 to 72 in 1e0831e
reportIDparam in route here so thereportIDof waypoint page will not beundefinedwhen we create a distance requestApp/src/pages/iou/request/step/IOURequestStepDistance.tsx
Line 185 in 1e0831e
reportIDofexistingSplitChatReportis empty or not instead of checkingexistingSplitChatReportApp/src/libs/actions/IOU.ts
Line 3756 in 1e0831e
App/src/libs/actions/IOU.ts
Line 3761 in 1e0831e
What alternative solutions did you explore? (Optional)
tsa321 commentedon Jun 17, 2024
maybe related to #40579
truph01 commentedon Jun 18, 2024
It's not related to #40579. The RCA is different.
zanyrenney commentedon Jun 18, 2024
https://expensify.slack.com/archives/GP2FVSJ7Q/p1718649701046849?thread_ts=1718648773.503349&cid=GP2FVSJ7Q VIP split is on pause, so going to close this for now as it is not a priority right now.