Skip to content

Commit

Permalink
Merge pull request #48096 from bernhardoj/fix/48072-app-crash-after-l…
Browse files Browse the repository at this point in the history
…eaving-group

Fix crash after leaving group as the last member

(cherry picked from commit 9c0c647)

(CP triggered by puneetlath)
  • Loading branch information
puneetlath authored and OSBotify committed Aug 27, 2024
1 parent 44cc4c5 commit 83cd596
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/libs/actions/ReportActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function clearReportActionErrors(reportID: string, reportAction: ReportAction, k
});

// If there's a linked transaction, delete that too
const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportAction.reportActionID, originalReportID ?? '-1');
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportAction.reportActionID, originalReportID || '-1');
if (linkedTransactionID) {
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
typeRef.current = type;
reportIDRef.current = reportID ?? '-1';
reportActionIDRef.current = reportActionID ?? '-1';
originalReportIDRef.current = originalReportID ?? '-1';
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
originalReportIDRef.current = originalReportID || '-1';
selectionRef.current = selection;
setIsPopoverVisible(true);
reportActionDraftMessageRef.current = draftMessage;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ function ReportActionItem({
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const blockedFromConcierge = useBlockedFromConcierge();
const originalReportID = useMemo(() => ReportUtils.getOriginalReportID(report.reportID, action) ?? '-1', [report.reportID, action]);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const originalReportID = useMemo(() => ReportUtils.getOriginalReportID(report.reportID, action) || '-1', [report.reportID, action]);
const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`, {
selector: (draftMessagesForReport) => {
const matchingDraftMessage = draftMessagesForReport?.[action.reportActionID];
Expand Down

0 comments on commit 83cd596

Please sign in to comment.