Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate back to parent report after deleting last comment of thread #45563

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
7 changes: 6 additions & 1 deletion src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const wasLoadingApp = usePrevious(isLoadingApp);
const finishedLoadingApp = wasLoadingApp && !isLoadingApp;
const isDeletedParentAction = ReportActionsUtils.isDeletedParentAction(parentReportAction);
const prevIsDeletedParentAction = usePrevious(isDeletedParentAction);

const isLoadingReportOnyx = isLoadingOnyxValue(reportResult);
const permissions = useDeepCompareRef(reportOnyx?.permissions);
Expand Down Expand Up @@ -534,7 +536,8 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
(!prevUserLeavingStatus && !!userLeavingStatus) ||
didReportClose ||
isRemovalExpectedForReportType ||
isClosedTopLevelPolicyRoom
isClosedTopLevelPolicyRoom ||
(prevIsDeletedParentAction && !isDeletedParentAction)
) {
// Early return if the report we're passing isn't in a focused state. We only want to navigate to Concierge if the user leaves the room from another device or gets removed from the room while the report is in a focused state.
// Prevent auto navigation for report in RHP
Expand Down Expand Up @@ -584,6 +587,8 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
prevReport,
reportIDFromRoute,
isFocused,
isDeletedParentAction,
prevIsDeletedParentAction,
]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemContentCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function ReportActionItemContentCreated({contextValue, parentReportAction, trans
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
const isReversedTransaction = ReportActionsUtils.isReversedTransaction(parentReportAction);

if (ReportActionsUtils.isDeletedParentAction(parentReportAction) || isReversedTransaction) {
if (ReportActionsUtils.isMessageDeleted(parentReportAction) || isReversedTransaction) {
let message: TranslationPaths;

if (isReversedTransaction) {
Expand Down
Loading