Skip to content

Commit e4d3540

Browse files
authored
Merge pull request #58543 from daledah/fix/57769
fix: empty background when invited to private chat
2 parents a0d1265 + 7629792 commit e4d3540

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/pages/home/ReportScreen.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,14 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
496496
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
497497
}, [route, isLinkedMessagePageReady, reportActionIDFromRoute]);
498498

499+
const prevReportActions = usePrevious(reportActions);
500+
useEffect(() => {
501+
if (prevReportActions.length !== 0 || reportActions.length === 0) {
502+
return;
503+
}
504+
fetchReport();
505+
}, [prevReportActions, reportActions, fetchReport]);
506+
499507
// If a user has chosen to leave a thread, and then returns to it (e.g. with the back button), we need to call `openReport` again in order to allow the user to rejoin and to receive real-time updates
500508
useEffect(() => {
501509
if (!shouldUseNarrowLayout || !isFocused || prevIsFocused || !isChatThread(report) || !isHiddenForCurrentUser(report) || isSingleTransactionView) {

tests/ui/PaginationTest.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ describe('Pagination', () => {
282282
await navigateToSidebarOption(REPORT_ID);
283283

284284
expect(getReportActions()).toHaveLength(5);
285-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 1);
285+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 2);
286286
TestHelper.expectAPICommandToHaveBeenCalledWith('OpenReport', 0, {reportID: REPORT_ID});
287287
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
288288
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 0);
@@ -293,7 +293,7 @@ describe('Pagination', () => {
293293
scrollToOffset(0);
294294
await waitForBatchedUpdatesWithAct();
295295

296-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 1);
296+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 2);
297297
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
298298
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 0);
299299
});
@@ -306,7 +306,7 @@ describe('Pagination', () => {
306306
await navigateToSidebarOption(REPORT_ID);
307307

308308
expect(getReportActions()).toHaveLength(CONST.REPORT.MIN_INITIAL_REPORT_ACTION_COUNT);
309-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 1);
309+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 2);
310310
TestHelper.expectAPICommandToHaveBeenCalledWith('OpenReport', 0, {reportID: REPORT_ID});
311311
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
312312
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 0);
@@ -315,7 +315,7 @@ describe('Pagination', () => {
315315
scrollToOffset(LIST_CONTENT_SIZE.height);
316316
await waitForBatchedUpdatesWithAct();
317317

318-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 1);
318+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 2);
319319
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 1);
320320
TestHelper.expectAPICommandToHaveBeenCalledWith('GetOlderActions', 0, {reportID: REPORT_ID, reportActionID: '4'});
321321
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 0);
@@ -350,7 +350,7 @@ describe('Pagination', () => {
350350
expect(getReportActions()).toHaveLength(10);
351351

352352
// There is 1 extra call here because of the comment linking report.
353-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 3);
353+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 4);
354354
TestHelper.expectAPICommandToHaveBeenCalledWith('OpenReport', 1, {reportID: REPORT_ID, reportActionID: '5'});
355355
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
356356
TestHelper.expectAPICommandToHaveBeenCalledWith('GetNewerActions', 0, {reportID: REPORT_ID, reportActionID: '5'});
@@ -361,7 +361,7 @@ describe('Pagination', () => {
361361
scrollToOffset(0);
362362
await waitForBatchedUpdatesWithAct();
363363

364-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 3);
364+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 4);
365365
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
366366
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 1);
367367

@@ -376,7 +376,7 @@ describe('Pagination', () => {
376376
scrollToOffset(0);
377377
await waitForBatchedUpdatesWithAct();
378378

379-
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 3);
379+
TestHelper.expectAPICommandToHaveBeenCalled('OpenReport', 4);
380380
TestHelper.expectAPICommandToHaveBeenCalled('GetOlderActions', 0);
381381
TestHelper.expectAPICommandToHaveBeenCalled('GetNewerActions', 1);
382382

0 commit comments

Comments
 (0)