Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2734,6 +2734,11 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`,
value: {[reportPreviewReportActionID]: optimisticReportPreview},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`,
value: {lastVisibleActionCreated: optimisticReportPreview.created},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We removed optimistically setting the lastVisibleActionCreated as it caused #65617. Further, the scroll issue mentioned here no longer needs this change.

},
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
Expand Down Expand Up @@ -2766,6 +2771,12 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
value: quickAction ?? null,
},

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`,
value: {lastVisibleActionCreated: parentReport?.lastVisibleActionCreated},
},
];

const successData: OnyxUpdate[] = [
Expand Down
3 changes: 2 additions & 1 deletion tests/actions/ReportTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1558,9 +1558,10 @@ describe('actions/Report', () => {
// callback: (reports) => {
// Onyx.disconnect(connection);
// const createdReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];

// const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`];
// // assert correctness of crucial onyx data
// expect(createdReport?.reportID).toBe(reportID);
// expect(parentPolicyExpenseChat?.lastVisibleActionCreated).toBe(reportPreviewAction?.created);
// expect(createdReport?.total).toBe(0);
// expect(createdReport?.parentReportActionID).toBe(reportPreviewAction?.reportActionID);

Expand Down