Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
isGroupChat as isGroupChatReportUtils,
isHiddenForCurrentUser,
isIOUReportUsingReport,
isMoneyRequest,
isMoneyRequestReport,
isOpenExpenseReport,
isProcessingReport,
Expand Down Expand Up @@ -281,7 +282,7 @@
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined

Check warning on line 285 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
if (!value?.accountID) {
conciergeReportID = undefined;
return;
Expand All @@ -295,7 +296,7 @@
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => (conciergeReportID = value),
});

Check warning on line 299 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
// map of reportID to all reportActions for that report
const allReportActions: OnyxCollection<ReportActions> = {};

Expand All @@ -303,7 +304,7 @@
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
callback: (actions, key) => {
if (!key || !actions) {
return;

Check warning on line 307 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
}
const reportID = CollectionUtils.extractCollectionItemID(key);
allReportActions[reportID] = actions;
Expand All @@ -315,7 +316,7 @@
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
allReports = value;

Check warning on line 319 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
},
});

Expand All @@ -324,7 +325,7 @@
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
},

Check warning on line 328 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
});

const typingWatchTimers: Record<string, NodeJS.Timeout> = {};
Expand All @@ -339,7 +340,7 @@
key: ONYXKEYS.NVP_ONBOARDING,
callback: (val) => {
if (Array.isArray(val)) {
return;

Check warning on line 343 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
}
onboarding = val;
},
Expand All @@ -350,13 +351,13 @@
key: ONYXKEYS.NVP_INTRO_SELECTED,
callback: (val) => (introSelected = val),
});

Check warning on line 354 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
let allReportDraftComments: Record<string, string | undefined> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT,
waitForCollectionCallback: true,
callback: (value) => (allReportDraftComments = value),
});

Check warning on line 360 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

let environment: EnvironmentType;
getEnvironment().then((env) => {
Expand Down Expand Up @@ -1940,10 +1941,13 @@
}

// Handle cleanup of stale optimistic IOU report and its report preview separately
if (isMoneyRequestReport(report) && parentReportActionID) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, {
[parentReportActionID]: null,
});
if ((isMoneyRequestReport(report) || isMoneyRequest(report)) && parentReportID && parentReportActionID) {
const parentReportAction = allReportActions?.[parentReportID]?.[parentReportActionID];
if (parentReportAction?.childReportID === reportID) {
Copy link
Copy Markdown
Contributor

@bernhardoj bernhardoj Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we do this?

if (parentReportAction?.childReportID === reportID) {

Copy link
Copy Markdown
Member Author

@s77rt s77rt Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! We need to clear IOU action only if it was created optimistically and it's still pointing to the optimistic report that we are clearing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X-posting: #75101 (comment)

Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, {
[parentReportActionID]: null,
});
}
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, null);
return;
}
Expand Down
Loading