Skip to content

Commit a2d987f

Browse files
authored
Merge pull request Expensify#64917 from FitseTLT/fix-scroll-to-bottom-bug-on-create-report
Fix- Reports - In employee workspace chat, report created is not scrolled to bottom
2 parents 7d59152 + 645f6a4 commit a2d987f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/libs/actions/Report.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,6 +2734,11 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin
27342734
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`,
27352735
value: {[reportPreviewReportActionID]: optimisticReportPreview},
27362736
},
2737+
{
2738+
onyxMethod: Onyx.METHOD.MERGE,
2739+
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`,
2740+
value: {lastVisibleActionCreated: optimisticReportPreview.created},
2741+
},
27372742
{
27382743
onyxMethod: Onyx.METHOD.SET,
27392744
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
@@ -2766,6 +2771,12 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin
27662771
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
27672772
value: quickAction ?? null,
27682773
},
2774+
2775+
{
2776+
onyxMethod: Onyx.METHOD.MERGE,
2777+
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`,
2778+
value: {lastVisibleActionCreated: parentReport?.lastVisibleActionCreated},
2779+
},
27692780
];
27702781

27712782
const successData: OnyxUpdate[] = [

tests/actions/ReportTest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,9 +1558,10 @@ describe('actions/Report', () => {
15581558
// callback: (reports) => {
15591559
// Onyx.disconnect(connection);
15601560
// const createdReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
1561-
1561+
// const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`];
15621562
// // assert correctness of crucial onyx data
15631563
// expect(createdReport?.reportID).toBe(reportID);
1564+
// expect(parentPolicyExpenseChat?.lastVisibleActionCreated).toBe(reportPreviewAction?.created);
15641565
// expect(createdReport?.total).toBe(0);
15651566
// expect(createdReport?.parentReportActionID).toBe(reportPreviewAction?.reportActionID);
15661567

0 commit comments

Comments
 (0)