Skip to content

Commit

Permalink
Merge pull request #36688 from Expensify/monil-fixThreadHeaderLoading
Browse files Browse the repository at this point in the history
Fix infinite loading in header when thread's parent message is deleted
  • Loading branch information
techievivek authored Feb 16, 2024
2 parents 0318f41 + e282d94 commit 6fb79c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2503,6 +2503,10 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
return getTransactionReportName(parentReportAction);
}

if (parentReportAction?.message?.[0]?.isDeletedParentAction) {
return Localize.translateLocal('parentReportAction.deletedMessage');
}

const isAttachment = ReportActionsUtils.isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : null);
const parentReportActionMessage = (parentReportAction?.message?.[0]?.text ?? '').replace(/(\r\n|\n|\r)/gm, ' ');
if (isAttachment && parentReportActionMessage) {
Expand All @@ -2518,7 +2522,7 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
if (isAdminRoom(report) || isUserCreatedPolicyRoom(report)) {
return getAdminRoomInvitedParticipants(parentReportAction, parentReportActionMessage);
}
return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');
return parentReportActionMessage;
}

if (isTaskReport(report) && isCanceledTaskReport(report, parentReportAction)) {
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/ReportAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Message = {
/** Fragment edited flag */
isEdited?: boolean;

/** Whether thread's parent message is deleted or not */
isDeletedParentAction?: boolean;

/** Whether the pending transaction was reversed and didn't post to the card */
Expand Down

0 comments on commit 6fb79c8

Please sign in to comment.