Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,12 @@ function deleteReportComment(reportID: string, reportAction: ReportAction) {
CachedPDFPaths.clearByKey(reportActionID);

API.write(WRITE_COMMANDS.DELETE_COMMENT, parameters, {optimisticData, successData, failureData});

// if we are linking to the report action, and we are deleting it, and it's not a deleted parent action,
// we should navigate to its report in order to not show not found page
if (Navigation.isActiveRoute(ROUTES.REPORT_WITH_ID.getRoute(reportID, reportActionID)) && !isDeletedParentAction) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{bz checklist} coming from #64320 isActiveRoute does not handle in case we have urlParams like "backTo" which caused this #64320,

Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID), true);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import ConfirmModal from '@components/ConfirmModal';
import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent';
import useLocalize from '@hooks/useLocalize';
import calculateAnchorPosition from '@libs/calculateAnchorPosition';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as IOU from '@userActions/IOU';
import * as Report from '@userActions/Report';
import ROUTES from '@src/ROUTES';
import type {AnchorDimensions} from '@src/styles';
import type {ReportAction} from '@src/types/onyx';
import BaseReportActionContextMenu from './BaseReportActionContextMenu';
Expand Down Expand Up @@ -274,9 +272,6 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
}
} else if (reportAction) {
Report.deleteReportComment(reportIDRef.current, reportAction);
if (!((reportAction?.childVisibleActionCount ?? 0) > 0)) {
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportIDRef.current));
}
}

DeviceEventEmitter.emit(`deletedReportAction_${reportIDRef.current}`, reportAction?.reportActionID);
Expand Down