Skip to content

Revert "PreexistingReport: clear stale IOU action on transaction threads"#79964

Closed
rayane-d wants to merge 2 commits intoExpensify:mainfrom
rayane-d:revert-79356-preexistingreport-clean-up-iou
Closed

Revert "PreexistingReport: clear stale IOU action on transaction threads"#79964
rayane-d wants to merge 2 commits intoExpensify:mainfrom
rayane-d:revert-79356-preexistingreport-clean-up-iou

Conversation

@rayane-d
Copy link
Copy Markdown
Contributor

@rayane-d rayane-d commented Jan 20, 2026

Reverts #79356

In PR #75101, these tests started failing on the PR branch after PR #79356 was merged.

  ● actions/Report › handlePreexistingReport › should handle preexistingReportID for one-transaction report

    expect(received).toBe(expected) // Object.is equality

    Expected: "5555"
    Received: undefined

      3239 |             // Then the childReportID of the IOU action should be updated
      3240 |             const iouReportActions = await getOnyxValue(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`);
    > 3241 |             expect(iouReportActions?.['1']?.childReportID).toBe(preexistingReportID);
           |                                                            ^
      3242 |         });
      3243 |
      3244 |         it('should handle preexistingReportID for multi-transaction report', async () => {

      at Object.toBe (tests/actions/ReportTest.ts:3241:60)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:9)

  ● actions/Report › handlePreexistingReport › should handle preexistingReportID for multi-transaction report

    expect(received).toBe(expected) // Object.is equality

    Expected: "5555"
    Received: undefined

      3318 |             // Then the childReportID of the IOU action should be updated
      3319 |             const iouReportActions = await getOnyxValue(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`);
    > 3320 |             expect(iouReportActions?.[iouReportAction1.reportActionID]?.childReportID).toBe(preexistingReportID);
           |                                                                                        ^
      3321 |         });
      3322 |
      3323 |         it('should handle preexistingReportID for thread under comment', async () => {

      at Object.toBe (tests/actions/ReportTest.ts:3320:88)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:9)

From Abdelhafidh in #75101 (comment):

👋 @rayane-d I just tested on main and also on this PR (without the fix) and I'm no longer able to reproduce the original bug of duplicate IOU actions. Thus i think we can go ahead and remove that Handle cleanup of stale optimistic IOU report and its report preview separately section.

Screen.Recording.2026-01-20.at.2.06.20.PM.mov
Screen.Recording.2026-01-20.at.2.07.42.PM.mov

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 20, 2026

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/actions/Report.ts 53.86% <50.00%> (-0.06%) ⬇️
... and 22 files with indirect coverage changes

@mountiny mountiny self-requested a review January 20, 2026 17:22
@mountiny
Copy link
Copy Markdown
Contributor

Can you make this ready for a review?

@mountiny
Copy link
Copy Markdown
Contributor

@rayane-d should we close this or?

@rayane-d rayane-d closed this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants