Skip to content

Commit dd6622e

Browse files
authored
Merge pull request Expensify#74438 from mkzie2/mkzie2-issue/68521-regressions
Pinned Room Shows "No Activity" After Workspace Is Deleted
2 parents 07f08e2 + 3e81747 commit dd6622e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/libs/SidebarUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ function getReportsToDisplayInLHN(
252252
const reportsToDisplay: ReportsToDisplayInLHN = {};
253253

254254
for (const [reportID, report] of Object.entries(allReportsDictValues)) {
255-
if (!report) {
255+
if (!report?.reportID && report?.pendingFields?.reportID !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
256256
continue;
257257
}
258258

@@ -306,7 +306,7 @@ function updateReportsToDisplayInLHN({
306306
const displayedReportsCopy = {...displayedReports};
307307
for (const reportID of updatedReportsKeys) {
308308
const report = reports?.[reportID];
309-
if (!report) {
309+
if (!report?.reportID && report?.pendingFields?.reportID !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
310310
continue;
311311
}
312312

src/libs/actions/Report.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,6 +3585,9 @@ function leaveGroupChat(reportID: string, shouldClearQuickAction: boolean) {
35853585
notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
35863586
},
35873587
},
3588+
pendingFields: {
3589+
reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
3590+
},
35883591
},
35893592
},
35903593
];
@@ -3608,6 +3611,15 @@ function leaveGroupChat(reportID: string, shouldClearQuickAction: boolean) {
36083611
];
36093612

36103613
const failureData: OnyxUpdate[] = [
3614+
{
3615+
onyxMethod: Onyx.METHOD.MERGE,
3616+
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
3617+
value: {
3618+
pendingFields: {
3619+
reportID: null,
3620+
},
3621+
},
3622+
},
36113623
{
36123624
onyxMethod: Onyx.METHOD.MERGE,
36133625
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
@@ -3658,6 +3670,9 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal
36583670
notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
36593671
},
36603672
},
3673+
pendingFields: {
3674+
reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
3675+
},
36613676
},
36623677
},
36633678
];
@@ -3686,6 +3701,15 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal
36863701
}
36873702

36883703
const failureData: OnyxUpdate[] = [
3704+
{
3705+
onyxMethod: Onyx.METHOD.MERGE,
3706+
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
3707+
value: {
3708+
pendingFields: {
3709+
reportID: null,
3710+
},
3711+
},
3712+
},
36893713
{
36903714
onyxMethod: Onyx.METHOD.MERGE,
36913715
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,

0 commit comments

Comments
 (0)